Re: CFTRY / CFCATCH not working
not an answer to your question, but have you tried using ImageMagick or cfx_openimage instead ? I have found both to be more reliable than CF's built in image handling. On Tue, Sep 9, 2014 at 6:56 PM, Robert Harrison wrote: > > It's a seven year old site but it's on a CF10 server. Tried using CFIMAGE > but it's too slow. > > Robert Harrison > Director of Interactive Services > > Austin & Williams > Advertising I Branding I Digital I Direct > 125 Kennedy Drive, Suite 100 I Hauppauge, NY 11788 > T 631.231.6600 X 119 F 631.434.7022 > http://www.austin-williams.com > > Blog: http://www.austin-williams.com/blog > Twitter: http://www.twitter.com/austi > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359262 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CFTRY / CFCATCH not working
Looks like the code you are using is bhImgInfo() from cflib, with only very slight changes. There's more than one way to skin that cat: https://gist.github.com/vikaskanani/6256084 looks more robust in the catch department. Maybe a little too robust, but it also separates out the file read from the createObject statement. -- --m@Robertson-- Janitor, The Robertson Team mysecretbase.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359261 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: CFTRY / CFCATCH not working
It's a seven year old site but it's on a CF10 server. Tried using CFIMAGE but it's too slow. Robert Harrison Director of Interactive Services Austin & Williams Advertising I Branding I Digital I Direct 125 Kennedy Drive, Suite 100 I Hauppauge, NY 11788 T 631.231.6600 X 119 F 631.434.7022 http://www.austin-williams.com Blog: http://www.austin-williams.com/blog Twitter: http://www.twitter.com/austi ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359259 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CFTRY / CFCATCH not working
"Numbers of source Raster bands and source color space components do not match null" Where do you see this error? In the exception logs? Or is the thread just dying and outputting this and not continuing on? Also what CF Version, I know older versions seemed to have many more problems reading image files than more recent version. On Tue, Sep 9, 2014 at 1:33 PM, Robert Harrison wrote: > > Thanks, but that had no effect at all. > > Robert Harrison > Director of Interactive Services > > Austin & Williams > Advertising I Branding I Digital I Direct > 125 Kennedy Drive, Suite 100 I Hauppauge, NY 11788 > T 631.231.6600 X 119 F 631.434.7022 > http://www.austin-williams.com > > Blog: http://www.austin-williams.com/blog > Twitter: http://www.twitter.com/austin_williams > > > -Original Message- > From: Cameron Childress [mailto:camer...@gmail.com] > Sent: Tuesday, September 09, 2014 1:25 PM > To: cf-talk > Subject: Re: CFTRY / CFCATCH not working > > > If there is an error in your error handling code you will get a hard > error. It may be because you are still attempting to work with the corrupt > file in your catch. > > Change this: > get_imginfo.ImgHeight=0> > > To this: > > > ...and see if it makes the error go away. > > -Cameron > > On Tue, Sep 9, 2014 at 1:02 PM, Robert Harrison < > rob...@austin-williams.com> > wrote: > > > > > I have a script that returns image properties to me (below). After > years > > of using it I've hit some sort of file that crashes it. The error I'm > > getting is: > > > > Numbers of source Raster bands and source color space > > components do not match null > > > > I'm assuming that from a corrupt image file, but the real problem is I > > wrapped this in a cftry / cfcatch (as shown below) and it's ignoring > > the CFTRY and giving me a hard error. > > > > > > > > > > function get_imageinfo(imgfile){ > > jFileIn = > > createObject("java","java.io.File").init(imgfile); > > ImageInfo = StructNew(); > > ImageObject = > > createObject("java","javax.imageio.ImageIO").read(jFileIn); > > <-THIS IS THE OFFENDING LINE > > imageFile = CreateObject("java", > > "java.io.File"); > > imageFile.init(imgfile); > > sizeb = imageFile.length(); > > sizekb = numberformat(sizeb / 1024, > > "9.99"); > > sizemb = numberformat(sizekb / 1024, > > ".99"); > > get_imginfo = StructNew(); > > get_imginfo.ImgWidth = > > ImageObject.getWidth(); > > get_imginfo.ImgHeight = > > ImageObject.getHeight(); > > get_imginfo.SizeKB = sizekb; > > get_imginfo.SizeMB = sizemb; > > get_imginfo.ImageFormat = > > ListLast(ListLast(imgfile, "\"), "."); > > } > > > > > get_imginfo.ImgWidth=0> > > > > > > > > It runs this in a loop over a bunch of images and works until it hits > > the bad file... but it's ignoring my CFTRY and still throwing a hard > error. > > > > Anyone have any ideas on why the CRFTY/CFCATCH is not working. Is > > there a problem because I'm catching a cfscript block? > > > > Thanks > > > > Robert Harrison > > Director of Interactive Services > > > > Austin & Williams > > Advertising I Branding I Digital I Direct > > 125 Kennedy Drive, Suite 100 I Hauppauge, NY 11788 > > T 631.231.6600 X 119 F 631.434.7022 > > http://www.austin-williams.com > > > > Blog: http://www.austin-williams.com/blog > > Twitter: http://www.twitter.com/austin_williams > > > > > > > > > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359258 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CFTRY / CFCATCH not working
Any particular reason you are not using cfscript versions of try/catch? Old version of CF? try { code goes here } catch(Any excpt) { code goes here } Given any thought to a different image processor to see if you get a different result? I'm thinking cfimage, assuming you are using at least CF8. -- --m@Robertson-- Janitor, The Robertson Team mysecretbase.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359257 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: CFTRY / CFCATCH not working
Thanks, but that had no effect at all. Robert Harrison Director of Interactive Services Austin & Williams Advertising I Branding I Digital I Direct 125 Kennedy Drive, Suite 100 I Hauppauge, NY 11788 T 631.231.6600 X 119 F 631.434.7022 http://www.austin-williams.com Blog: http://www.austin-williams.com/blog Twitter: http://www.twitter.com/austin_williams -Original Message- From: Cameron Childress [mailto:camer...@gmail.com] Sent: Tuesday, September 09, 2014 1:25 PM To: cf-talk Subject: Re: CFTRY / CFCATCH not working If there is an error in your error handling code you will get a hard error. It may be because you are still attempting to work with the corrupt file in your catch. Change this: To this: ...and see if it makes the error go away. -Cameron On Tue, Sep 9, 2014 at 1:02 PM, Robert Harrison wrote: > > I have a script that returns image properties to me (below). After years > of using it I've hit some sort of file that crashes it. The error I'm > getting is: > > Numbers of source Raster bands and source color space > components do not match null > > I'm assuming that from a corrupt image file, but the real problem is I > wrapped this in a cftry / cfcatch (as shown below) and it's ignoring > the CFTRY and giving me a hard error. > > > > > function get_imageinfo(imgfile){ > jFileIn = > createObject("java","java.io.File").init(imgfile); > ImageInfo = StructNew(); > ImageObject = > createObject("java","javax.imageio.ImageIO").read(jFileIn); > <-THIS IS THE OFFENDING LINE > imageFile = CreateObject("java", > "java.io.File"); > imageFile.init(imgfile); > sizeb = imageFile.length(); > sizekb = numberformat(sizeb / 1024, > "9.99"); > sizemb = numberformat(sizekb / 1024, > ".99"); > get_imginfo = StructNew(); > get_imginfo.ImgWidth = > ImageObject.getWidth(); > get_imginfo.ImgHeight = > ImageObject.getHeight(); > get_imginfo.SizeKB = sizekb; > get_imginfo.SizeMB = sizemb; > get_imginfo.ImageFormat = > ListLast(ListLast(imgfile, "\"), "."); > } > > get_imginfo.ImgWidth=0> > > > > It runs this in a loop over a bunch of images and works until it hits > the bad file... but it's ignoring my CFTRY and still throwing a hard error. > > Anyone have any ideas on why the CRFTY/CFCATCH is not working. Is > there a problem because I'm catching a cfscript block? > > Thanks > > Robert Harrison > Director of Interactive Services > > Austin & Williams > Advertising I Branding I Digital I Direct > 125 Kennedy Drive, Suite 100 I Hauppauge, NY 11788 > T 631.231.6600 X 119 F 631.434.7022 > http://www.austin-williams.com > > Blog: http://www.austin-williams.com/blog > Twitter: http://www.twitter.com/austin_williams > > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359256 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CFTRY / CFCATCH not working
If there is an error in your error handling code you will get a hard error. It may be because you are still attempting to work with the corrupt file in your catch. Change this: To this: ...and see if it makes the error go away. -Cameron On Tue, Sep 9, 2014 at 1:02 PM, Robert Harrison wrote: > > I have a script that returns image properties to me (below). After years > of using it I've hit some sort of file that crashes it. The error I'm > getting is: > > Numbers of source Raster bands and source color space components > do not match null > > I'm assuming that from a corrupt image file, but the real problem is I > wrapped this in a cftry / cfcatch (as shown below) and it's ignoring the > CFTRY and giving me a hard error. > > > > > function get_imageinfo(imgfile){ > jFileIn = > createObject("java","java.io.File").init(imgfile); > ImageInfo = StructNew(); > ImageObject = > createObject("java","javax.imageio.ImageIO").read(jFileIn); > <-THIS IS THE OFFENDING LINE > imageFile = CreateObject("java", > "java.io.File"); > imageFile.init(imgfile); > sizeb = imageFile.length(); > sizekb = numberformat(sizeb / 1024, > "9.99"); > sizemb = numberformat(sizekb / 1024, > ".99"); > get_imginfo = StructNew(); > get_imginfo.ImgWidth = > ImageObject.getWidth(); > get_imginfo.ImgHeight = > ImageObject.getHeight(); > get_imginfo.SizeKB = sizekb; > get_imginfo.SizeMB = sizemb; > get_imginfo.ImageFormat = > ListLast(ListLast(imgfile, "\"), "."); > } > > get_imginfo.ImgWidth=0> > > > > It runs this in a loop over a bunch of images and works until it hits the > bad file... but it's ignoring my CFTRY and still throwing a hard error. > > Anyone have any ideas on why the CRFTY/CFCATCH is not working. Is there a > problem because I'm catching a cfscript block? > > Thanks > > Robert Harrison > Director of Interactive Services > > Austin & Williams > Advertising I Branding I Digital I Direct > 125 Kennedy Drive, Suite 100 I Hauppauge, NY 11788 > T 631.231.6600 X 119 F 631.434.7022 > http://www.austin-williams.com > > Blog: http://www.austin-williams.com/blog > Twitter: http://www.twitter.com/austin_williams > > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359255 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm