You can use FileExists(absolute_path) in an if statement.

Eg. 
<cfif FileExists("C:\www\images\picture.gif")>
        <img src="C:\www\images\picture.gif">
<cfelse>
        <img src="C:\www\images\no_picture.gif">
</cfif>

Chris

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Reil
Sent: Thursday, July 27, 2006 7:28 AM
To: discussion@acfug.org
Subject: [ACFUG Discuss] Alternate image shown logic help?

Is there a way to have an alternate image called if an image called does
not exist?

For example:
We call out the image path for the image as if it would one day be
there.
When we shoot an image as it comes into inventory we place the image in
the correct directory, and name it the part number.jpg.

We would like to have a default image show if the correct image does not
exist.

Using the string:
******************
//'display the right product image
        if ( intImagePos EQ 3 ){
        WriteOutput("<td class=""ProductImage"">" & Chr(10) & Chr(13));
        //'show image
        if( Len(objProduct.getImage2()) GT 0 ){
        writeoutput("<img src=""" & objProduct.getImage2() & """ " &
objProduct.getImage2Params() & ">");
        }else{
        writeoutput("<p>No Picture Available</p>"); }
        WriteOutput("</td>");
*******************
How would you modify this to be able to do that?

I can see that it would be easy to change 
        }else{
        writeoutput("<p>No Picture Available</p>"); to show a path name
but it is VERY easy to add the file name even if it does not exist up
front.

Im thinking that instead of changing
        }else{
        writeoutput("<p>No Picture Available</p>"); I should use elseif
logic (hmm this is not even CF is it?) To say if the pic is not
available then call a certain image.
If that is not there then do
        }else{
        writeoutput("<p>No Picture Available</p>");

Robert P. Reil
Managing Director,
Motorcyclecarbs.com, Inc.
4292 Country Garden Walk NW
Kennesaw, Ga. 30152
Office 770-974-8851
Fax 770-974-8852
www.motorcyclecarbs.com 


-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists Archive @
http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------







-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------



Reply via email to