James Rodgers
asked on
CFIMAGE - Action = info - error when file is BMP
I am uploading a zip file of images to the server where they are extracted to a temp file and then manipulated in to thumbnails using cfimage and then moved to a permanent location, everything works finer unless one or more of the images is a bmp, if it is a bmp the procressing bombs on this line
<cfimage action="info" structname="imagetemp" source="#sTempExtDir#\#nam e#">
only happens with bmp's; does not happen with jpg, gif or png
i have wrapped it in a cftry to avoid this issue causing further errors, but the documentation says cfimage works with bmp files, any one have an idea why this would be causing preoblems?
<cfimage action="info" structname="imagetemp" source="#sTempExtDir#\#nam
only happens with bmp's; does not happen with jpg, gif or png
i have wrapped it in a cftry to avoid this issue causing further errors, but the documentation says cfimage works with bmp files, any one have an idea why this would be causing preoblems?
What is the error message ?
I had no problems running that code with .bmp files.
ASKER
ColdFusion was unable to create an image from the specified source file.
Ensure that the file is a vaild image file.
The error occurred in C:\Inetpub\wwwroot\myroger srewards\w ebsite\Con tentAdmin\ Media\Phot oGallery\v _UploadPho toGallery. cfm: line 207
Called from C:\Inetpub\wwwroot\mysite\ website\Co ntentAdmin \Media\Pho toGallery\ v_UploadPh otoGallery .cfm: line 204
Called from C:\Inetpub\wwwroot\mysite\ website\Co ntentAdmin \Media\Pho toGallery\ v_UploadPh otoGallery .cfm: line 1
205 : <!--- get current image sizing --->
206 :
207 : <cfimage action="info" structname="imagetemp" source="#sTempExtDir#\#nam e#">
208 : <!--- create thumbnail --->
209 :
coldfusion.image.ImageRead er$UnableT oCreateIma geExceptio n: ColdFusion was unable to create an image from the specified source file.
at coldfusion.image.ImageRead er.readIma ge(ImageRe ader.java: 108)
at coldfusion.image.Image.<in it>(Image. java:226)
at coldfusion.tagext.io.Image Tag.doStar tTag(Image Tag.java:4 14)
at coldfusion.runtime.CfJspPa ge._emptyT cfTag(CfJs pPage.java :2661)
at cfv_UploadPhotoGallery2ecf m734101774 ._factor1( C:\Inetpub \wwwroot\m ysite\webs ite\Conten tAdmin\Med ia\PhotoGa llery\v_Up loadPhotoG allery.cfm :207)
at cfv_UploadPhotoGallery2ecf m734101774 ._factor3( C:\Inetpub \wwwroot\m ysite\webs ite\Conten tAdmin\Med ia\PhotoGa llery\v_Up loadPhotoG allery.cfm :204)
at cfv_UploadPhotoGallery2ecf m734101774 .runPage(C :\Inetpub\ wwwroot\my site\websi te\Content Admin\Medi a\PhotoGal lery\v_Upl oadPhotoGa llery.cfm: 1)
at coldfusion.runtime.CfJspPa ge.invoke( CfJspPage. java:196)
at coldfusion.tagext.lang.Inc ludeTag.do StartTag(I ncludeTag. java:370)
at coldfusion.filter.Cfinclud eFilter.in voke(Cfinc ludeFilter .java:65)
Ensure that the file is a vaild image file.
The error occurred in C:\Inetpub\wwwroot\myroger
Called from C:\Inetpub\wwwroot\mysite\
Called from C:\Inetpub\wwwroot\mysite\
205 : <!--- get current image sizing --->
206 :
207 : <cfimage action="info" structname="imagetemp" source="#sTempExtDir#\#nam
208 : <!--- create thumbnail --->
209 :
coldfusion.image.ImageRead
at coldfusion.image.ImageRead
at coldfusion.image.Image.<in
at coldfusion.tagext.io.Image
at coldfusion.runtime.CfJspPa
at cfv_UploadPhotoGallery2ecf
at cfv_UploadPhotoGallery2ecf
at cfv_UploadPhotoGallery2ecf
at coldfusion.runtime.CfJspPa
at coldfusion.tagext.lang.Inc
at coldfusion.filter.Cfinclud
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if you using CF8 you can convert bmp image to jpg
<cfimage source="../cfdocs/images/a rtgallery/ aiden02.bm p" action="convert"
destination="aiden02.jpg">
<cfimage source="../cfdocs/images/a
destination="aiden02.jpg">
> if you using CF8 you can convert bmp image to jpg
If CF does not recognize the file as an image, it probably won't be able to convert it.
If CF does not recognize the file as an image, it probably won't be able to convert it.
also ensure that the file is exist in the directory specified
ASKER
i output the path and file names being processed, all files are processed until the loop hits a bmp file and then it just dumps the error given
there are about 20 files in the zip package; 5 gif, 6 jpg and the rest bmp, with cftry blocks placed around the image processing block the gif and jpg files are processed and thumbnails are created, without the cftry as soon as the first bmp file is hit the processing stops
there are about 20 files in the zip package; 5 gif, 6 jpg and the rest bmp, with cftry blocks placed around the image processing block the gif and jpg files are processed and thumbnails are created, without the cftry as soon as the first bmp file is hit the processing stops
Yes, but are the paths for the bmp's valid ... and are the files valid?
1. Do a FileExists to confirm the paths are correct
<cfoutput>
DEBUG BMP Exists: #FileExists(sTempExtDir &"\"& name)#
</cfoutput>
<cfimage action="info" structname="imagetemp" source="#sTempExtDir#\#nam e#">
2. If they are valid, can upload one of the bmp's here?
1. Do a FileExists to confirm the paths are correct
<cfoutput>
DEBUG BMP Exists: #FileExists(sTempExtDir &"\"& name)#
</cfoutput>
<cfimage action="info" structname="imagetemp" source="#sTempExtDir#\#nam
2. If they are valid, can upload one of the bmp's here?
3. Can you open any one of those bmp's with an image program (ms paint, etc..)
ASKER
is it possible that the mime type is different among different bmp files; i have had issues with file uploads before where i allowed jpg and a jpg extension file was uploaded and failed, and the mime type was actually jpeg, is this a possiibility? i remember a while a go, been a loooooong time since i used photoshop, there a was such a thing as a windows bitmap vs ??
i also discovered that one of the bmp files cannot be opened, however NO bmp files are being processed
i also discovered that one of the bmp files cannot be opened, however NO bmp files are being processed
You can double check the mime types, but if you are extracting them from a zip how does that apply here?
http://filext.com/file-extension/BMP
Well, cfimage can handle bmp's. You can try it yourself. Create a bmp with ms paint and test it out. It should work fine, which suggests there is a problem with the fiels themselves.
Can you upload one of the files?
http://filext.com/file-extension/BMP
Well, cfimage can handle bmp's. You can try it yourself. Create a bmp with ms paint and test it out. It should work fine, which suggests there is a problem with the fiels themselves.
Can you upload one of the files?
.. Also, try using ImageNew(..). Do you get the same results?
<cfset tempImage = ImageNew(sTempExtDir &"\"& name)>
<cfimage action="info" structname="imagetemp" source="#tempImage#">
<cfset tempImage = ImageNew(sTempExtDir &"\"& name)>
<cfimage action="info" structname="imagetemp" source="#tempImage#">
ASKER
same thing
any bmp file crashes the system or is ignored when cftry is implemented, one of the files is attached
joomla-error-simplest-forum.bmp
any bmp file crashes the system or is ignored when cftry is implemented, one of the files is attached
joomla-error-simplest-forum.bmp
Jester_48,
That is one of the bmp that crashes? It works perfectly for me (version 8,0,1,195765)
1) Are you sure you verified the file paths are correct
2) What version of CF are you using?
<cfdump var="#server#">
That is one of the bmp that crashes? It works perfectly for me (version 8,0,1,195765)
1) Are you sure you verified the file paths are correct
2) What version of CF are you using?
<cfdump var="#server#">
<cfset sTempExtDir = "c:\mydownload">
<cfset name = "joomla-error-simplest-forum.bmp">
<cfset tempImage = ImageNew(sTempExtDir &"\"& name)>
<cfimage action="info" structname="imagetemp" source="#tempImage#">
<cfdump var="#imagetemp#">
Results:
=============
struct
colormodel struct
alpha_channel_support NO
alpha_premultiplied NO
bits_component_1 8
bits_component_2 8
bits_component_3 8
colormodel_type ComponentColorModel
colorspace Any of the family of RGB color spaces
num_color_components 3
num_components 3
pixel_size 24
transparency OPAQUE
height 1050
source c:\mydownload\joomla-error-simplest-forum.bmp
width 1680
same same here... your posted .bmp file worked perfectly fine returning full imageinfo structure...
maybe you should post your complete code: uploading a zip file, extracting files from zip, querying the temp folder, running cfimage functions on extracted files... skip any non-relevant code parts like html layouts and such.
the problem must be in file paths or maybe something funny is happening with un-zipping the uploaded archive... what do you use to create the zip file in the first place? how are you un-zipping it?
you may want to cfdump the directory query you run before processing the images and cfabort after it just to make sure the file paths are actually what you think they are - depending on how the files were zipped and how you unzip them you may have a different resulting folder structure from what you think it is...
Azadi
maybe you should post your complete code: uploading a zip file, extracting files from zip, querying the temp folder, running cfimage functions on extracted files... skip any non-relevant code parts like html layouts and such.
the problem must be in file paths or maybe something funny is happening with un-zipping the uploaded archive... what do you use to create the zip file in the first place? how are you un-zipping it?
you may want to cfdump the directory query you run before processing the images and cfabort after it just to make sure the file paths are actually what you think they are - depending on how the files were zipped and how you unzip them you may have a different resulting folder structure from what you think it is...
Azadi
ASKER
>>That is one of the bmp that crashes? It works perfectly for me (version 8,0,1,195765)
unfortunately that's the only one i can post, the rst have private information in them i cannot put here, so it just might be those/that particular image(s)
any way this is all moot as the user has now changed the requirements to be jpg only, i will still look in to this, maybe the files are corrupted or are corrupting somehow in either the zip or unzip process
bu to answer some questions
the file paths and names are correct
all the files are extracted to a directory outside the web structure, this allows ANY file to be uploaded a s a zip, but i am only processing images, so if the user **inadvertently** uploads an exe it cannot be accessed through the web, all the files are in a single directory for a single upload, they are then processed via cfdirectory, cffile and cfimage to be made in to thumbnails in an "album" directory
i made my zip with winzip 11
server side i am using cfzip
unfortunately that's the only one i can post, the rst have private information in them i cannot put here, so it just might be those/that particular image(s)
any way this is all moot as the user has now changed the requirements to be jpg only, i will still look in to this, maybe the files are corrupted or are corrupting somehow in either the zip or unzip process
bu to answer some questions
the file paths and names are correct
all the files are extracted to a directory outside the web structure, this allows ANY file to be uploaded a s a zip, but i am only processing images, so if the user **inadvertently** uploads an exe it cannot be accessed through the web, all the files are in a single directory for a single upload, they are then processed via cfdirectory, cffile and cfimage to be made in to thumbnails in an "album" directory
i made my zip with winzip 11
server side i am using cfzip
> maybe the files are corrupted or are corrupting somehow in either the zip or unzip process
Yes, if you have verified the obvious (ie incorrect file paths) that would seem the most likely explanation.
Yes, if you have verified the obvious (ie incorrect file paths) that would seem the most likely explanation.