1. Verify file exists. Doesn't work unless you do relative URL it appears.
2. Use HTTP 'trace'. That didn't work either. Got a 'forbidden' response to everything.
3. Use "IsImage" with the full URL. That didn't work either, it believed everything to be ok.
4. Use HTTP 'head'. Then check for 200 OK response code. That worked!
<cfset myfileref="full-path-to-image-filename-goes-here">
<cfhttp method="head" url="#variables.myfileref#">
<cfif cfhttp.statusCode is not '200 OK'>
<cfset myfileref="#variables.path-to-file#/icon-spacer.gif">
So when variables.myfileref is called it will either be the valid image or the spacer replacement image I have, if needed.
PJ
No comments:
Post a Comment