| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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. |
|
#2
| |||
| |||
| 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/ |
|
#3
| |||
| |||
| 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> |
|
#4
| |||
| |||
| what's the error? you may have to set throwonerror to YES... Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ |
|
#5
| |||
| |||
| 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. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.