ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 check for valid file types?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
fjrohlf Posted - Jun 30 2013 : 18:54:37
Is there a convenient function in ImageEn that will simply verify whether a user entered file name corresponds to a supported image file type for input or output?

Jim
2   L A T E S T    R E P L I E S    (Newest First)
fjrohlf Posted - Jun 30 2013 : 20:14:05
Thanks!

Your IsKnownSaveFormat function is exactly what I need.

Jim
w2m Posted - Jun 30 2013 : 19:30:03
if hyieutils.IsKnownFormat(AFilename) then
  ShowMessage('ok, I can load it.');

For Opening and Saving add a TOpenPictureDialog or a TSavePictureDialog to the form then call:

procedure TForm1.FormCreate(Sender: TObject);
{ FormCreate. }
begin
  hyieutils.IERegisterFormats;
  OpenPictureDialog1.Filter := GraphicFilter(TGraphic);
  SavePictureDialog1.Filter := GraphicFilter(TGraphic);
end;
procedure TForm1.FormDestroy(Sender: TObject);
{ FormDestroy. }
begin
  hyieutils.IEUnRegisterFormats;
end;

The dialogs filter will include supported image formats.

Also by using ImageEn Helper functions you can create this:
function IsKnownOpenFormat(AFilename: string): boolean;
{ Return True if opening AFilename is supported by ImageEnIO, false if not. }
var
  iSupportedExtensions: string;
begin
   iSupportedExtensions := GetAllSupportedFileExtensions(True, False, False);
   result := IEFilenameInExtensions(AFilename, iSupportedExtensions);
end;

function IsKnownSaveFormat(AFilename: string): boolean;
{ Return True if saving AFilename is supported by ImageEnIO, false if not. }
var
  iSupportedExtensions: string;
begin
   iSupportedExtensions := GetAllSupportedFileExtensions(False, True, False);
   result := IEFilenameInExtensions(AFilename, iSupportedExtensions);
end;

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html