KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Handing stragglers of unsupported PICT files
PRODUCT: 4D | VERSION: 15.2 | PLATFORM: Mac & Win
Published On: August 11, 2016

When upgrading a database to v15, it is possible that one may not be aware that the PICT file codec might not be compatible. This utility method below will search for those unsupported PICT files and copy it to disk. The file will be created based on the record ID number.

// --------------------------------------------------------------------------------
// Name: UNSUPPORTED_PICT_EXTRACT_2_DISK
// Description: Method will search in a record selection PICT that are not
// compatible and copy to a disk.
// Input:
// $1 (POINTER) - Pointer to the picture field to search for unsupport PICT
// $2 (POINTER) - Pointer to the ID field to save the file name as that
// $3 (TEXT) - Location to save the folder to save the files to
// --------------------------------------------------------------------------------
C_POINTER($1;$fieldPic;$fieldPicPtr)
C_POINTER($2;$fieldId;$fieldIdPtr)
C_POINTER($tablePtr)
C_TEXT($3;$path)
C_LONGINT($i)

If (Count parameters=3)
   $fieldPic:=$1
   $fieldID:=$2
   $path:=$3

   $tablePtr:=Table(Table($fieldPic)) // Extracting the Table from the field
   $fieldPicPtr:=Field(Table($fieldPic);Field($fieldPic)) // Picture field
   $fieldIdPtr:=Field(Table($fieldId);Field($fieldId)) // Picture ID

   For ($i;1;Records in selection($tablePtr->))

      If ((AP is Picture Deprecated($fieldPicPtr))=1) //Deprecated file
         If (Folder separator=":") //Mac
            WRITE PICTURE FILE($path+":"+String($fieldIdPtr->);$fieldPicPtr->)
         Else // Windows
            WRITE PICTURE FILE($path+"\\"+String($fieldIdPtr->);$fieldPicPtr->)
         End if
      End if
      NEXT RECORD($tablePtr->)
   End for

End if


Note: 4D Pack Plugin is required for this method.


Here is a sample of using UNSUPPORTED_PICT_EXTRACT_2_DISK:

C_TEXT($loc)

ALL RECORDS([Table_1])

$loc:=Get 4D folder(Database folder)+"pict_ext"

UNSUPPORTED_PICT_EXTRACT_2_DISK (->[Table_1]Picture;->[Table_1]ID;$loc)


Here is the directory that saved the pictures:




See Also: