Know if is an image file

Know if is an image file

Postby Silvio.Falconi » Fri Jan 15, 2016 11:39 am

you can tell if a file is an image file ?

I need it because when I drop a file the procedure must Know if the file past is a image file or not
On old procedure I made a control on type of extension for some files type

IF UPPER( RIGHT( cFile, 3 ) ) == "JPG" ;
.OR. UPPER( RIGHT( cFile, 3 ) ) == "BMP" ;
.OR. UPPER( RIGHT( cFile, 3 ) ) == "PCX" ;
.OR. UPPER( RIGHT( cFile, 3 ) ) == "GIF" ;
.OR. UPPER( RIGHT( cFile, 3 ) ) == "TGA" ;
.OR. UPPER( RIGHT( cFile, 3 ) ) == "RLE" ;
.OR. UPPER( RIGHT( cFile, 3 ) ) == "PNG" ;
.OR. UPPER( RIGHT( cFile, 3 ) ) == "DIB"


But the type of file image are many and many other
I need all image Freeimage Know


I saw there is a function on Image class

IsImageData( cBuf )

How use it ? or is there a api function to Know it ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Know if is an image file

Postby ukoenig » Fri Jan 15, 2016 1:12 pm

Silvio,

You can get the file-extensions using :

cFileExt()
Retrieves the extension from a filename
Syntax:
cFileExt( <cFileName> ) --> cExtName
Parameters:
<cFileName> The filename whose extension to retrieve,
if the extension has been specified inside its filename.
Returns:
<cExtName> A three characters string with the extension name.
Source Code:
SOURCE\FUNCTION\FileName.prg

FREEIMAGE supports the following formats :

BMP, ICO, JPEG, JNG, KOALA, LBM, IFF = FIF_LBM
MNG, PBM, PBMRAW, PCD, PCX, PGM, PGMRAW
PNG, PPM, PPMRAW, RAS, TARGA,TIFF, WBMP
PSD, CUT, XBM, XPM, DDS, GIF, HDR, FAXG3
SGI, EXR, JP2


best regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Know if is an image file

Postby Silvio.Falconi » Fri Jan 15, 2016 9:11 pm

thanks Uwe,
I need this for the application I am creating software for electronic archiving and electronic storage of documents
Through management of colored binders for topics you can keep under control all office document or the household bills, receipts, contracts, etc. by storing them in files that can be viewed or printed
Ithnked to save image files, office and OpenOffice , Adobe Pdf documents
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 63 guests