QPx_TestImageFile

QPx_TestImageFile(imagePath; imagePath):error
imagePath Text Full path to image file
imageType Text Image type
error Longint Error result

Test if a file contains valid image data

If imagePath is a file that contains valid image data, imageType is set to a graphic importer type identifier (a non empty string) and returns qpx_noErr. If the file is not an image file, the imageType is set to an empty string and the qpx_paramErr error is returned.

If imagePath parameter is invalid, a file system error is returned. If imagePath is empty, QPix presents the file selection dialog where the user can preview and select an image file. If the user selects a file, its full pathname is returned in imagePath, otherwise error qpx_userCancelErr is returned.

Example

   // Test a gif image
C_LONGINT($error)
C_TEXT($imagePath)
C_TEXT($imageType)

$imagePath:="Hard disk:images:people.gif"
$imageType:=""

$error:=QPx_TestImageFile ($imagePath;$imageType)

If ($error=qpx_noErr)
   
   Case of 
      : ($imageType=qpx_GIFFile)
         
            // Handle gif file
         
   End case 
   
End if 

Related commands

QPx_GetImportTypes Get the list of available importers
QPx_ValidateImporter Ask importer to test its image data