Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
PeterPanino
Posted - Jul 02 2021 : 05:01:37 Does TImageEnView.IO have a built-in function CanLoadFile(AFile) or similar that returns True if the file can be loaded in ImageEnView?
do you have some of those "unloadable" example files (reported as ioUnknown), so I can experiment with them?
xequte
Posted - Jul 03 2021 : 00:46:57 Yes, though the risk with ffFallbackToExtension is that a file that has an invalid extension (such as a text file with a .JPEG extension) will be reported as loadable (ioJPEG).
If you use ffContentOnly:
Result := iexBitmaps.FindFileFormat(aFilePath, ffContentOnly) <> ioUnknown;
Then the file is almost certainly loadable by ImageEn (though there will be a small number of file types like some DICOM that will be reported as ioUnknown, but are actually loadable).
Posted - Jul 02 2021 : 05:49:18 Is this the most efficient simulation of such a function?:
function TformMain.ImageFileCanBeLoaded(const aFilePath: string): Boolean;
begin
Result := iexBitmaps.FindFileFormat(aFilePath, ffFallbackToExtension) <> ioUnknown;
end;