Don't want to display images

This is a discussion on Don't want to display images within the Cold Fusion forums in Application Servers & Tools category; Hello again. I have setup ImageCFC on my site and it seems to be working fairly well. However, every once in awhile it won't write an image to the hard drive when it says it has. I have an insert statement that adds an indicator to my db once the image file has been saved to the disk with the cfc. Some of the images don't get saved even though the insert runs AFTER the writing of the file. Is there a way to read the image on the hard disk before displaying it to the screen to make sure ...

Go Back   Application Development Forum > Application Servers & Tools > Cold Fusion

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 09-04-2008, 03:02 PM
idesdema
Guest
 
Default Don't want to display images

Hello again. I have setup ImageCFC on my site and it seems to be working
fairly well. However, every once in awhile it won't write an image to the hard
drive when it says it has. I have an insert statement that adds an indicator
to my db once the image file has been saved to the disk with the cfc.

Some of the images don't get saved even though the insert runs AFTER the
writing of the file. Is there a way to read the image on the hard disk before
displaying it to the screen to make sure its there? I hate displaying the ugly
red x when an image isn't there. I tried cffile "read" and that returned an
error when the file wasn't there.
http://livedocs.adobe.com/coldfusion...mon/html/wwhel
p.htm?context=ColdFusion_Documentation&file=000002 45.htm

Is there a way to look at the file and if its there, display it, if not,
don't. Otherwise how do I solve this prior to the db insert statement so the
table isn't lying to me.

Reply With Quote
  #2  
Old 09-04-2008, 09:39 PM
Azadi
Guest
 
Default Re: Don't want to display images

you can use fileexists() function to check if a file exists on the disk.
more details in the docs.

alternatively, you can use the not-so-well know onError event in img
tags to change the image source to some default "image not available"
image. this requires js support in browser to be enabled:

<img src="someimage.jpg" onError="this.src='notfound.jpg'">


Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Reply With Quote
  #3  
Old 09-05-2008, 12:48 AM
idesdema
Guest
 
Default Re: Don't want to display images

Great. Now the Image CFC problem... This used to work fine and now it does
not. Anyone have a guess?



<!--- Get thumb and create cropped from it --->
<cfquery name="get_thumb_to_crop1" datasource="myds">
SELECT pic_path_small FROM pics WHERE id = '123'
</cfquery>
<!--- cfc --->
<cfscript>
imagecfc = createObject("component","image");
imagecfc.setOption("throwOnError","No");
create_thumb_blur =
imagecfc.filterFastBlur("","#ExpandPath(".")#/thumbnails/#get_thumb_to_crop1.pic
_path_small#","#ExpandPath(".")#/thumbnails/cropped_thumbnails/#image_path1#",2,
1);
create_thumb_crop =
imagecfc.resize("","#ExpandPath(".")#/thumbnails/cropped_thumbnails/#image_path1
#","#ExpandPath(".")#/thumbnails/cropped_thumbnails/#image_path1#",70,70, true,
true);
</cfscript>


Reply With Quote
  #4  
Old 09-05-2008, 02:24 AM
Azadi
Guest
 
Default Re: Don't want to display images

what's the error? you may have to set throwonerror to YES...


Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Reply With Quote
  #5  
Old 09-05-2008, 11:27 AM
idesdema
Guest
 
Default Re: Don't want to display images

It just doesn't do what its supposed to. The code runs and there aren't any errors. However when I check to see if there was a new pic created it isn't there. Weird.
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 06:11 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.