Results 1 to 5 of 5
  1. #1
    Abina's Avatar
    Abina is offline Master
    Join Date
    Dec 2009
    Location
    United States
    Posts
    1,073
    Thanks
    1
    Thanked 6 Times in 4 Posts
    Feedback Score
    0

    Default If the image is not on the image folder show "no image"

    Hi.I need to show the images wich are in folder images & display "No Image" for those we have not the image in the folder.
    I wrote this code:

    <cfset PhotoLocation =
    "e:\www\NeedBattery\images\manufacturer\<cfoutput> #getBrands.cat_level2_image#</cfoutput>">
    <cfif not FileExists(PhotoLocation)>
    <cfoutput>no image</cfoutput>
    <cfelse>
    <a><img src="#imagePath#images/manufacturer/#getBrands.cat_level2_image#" width="60" height="40" /></a>
    </cfif>

    but the result is incorrect & typed "NO Image" for all the images.
    would u plz help me what is wrong with my code?
    thanks

  2. #2
    Join Date
    Sep 2009
    Posts
    1,135
    Thanks
    0
    Thanked 16 Times in 16 Posts
    Blog Entries
    1
    Feedback Score
    0

    Default

    if you dont like that idea you can do this but im not sure as i would have to have a look at your variables more first

    <cfif isdefined("#getBrands.cat_level2_image#")>
    <a><img src="#imagePath#images/manufacturer#getBrands.cat_level2_image#" width="60" height="40" /></a>
    <cfelse>
    <p>"No image"</p>
    </cfif>

    hope this helps

  3. #3
    numberone's Avatar
    numberone is offline Senior
    Join Date
    Jan 2010
    Posts
    623
    Thanks
    0
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default

    If you take the approach of a "missing image" like unitedlocalbands is explaining, then I would take it a step further and remove ColdFusion from the equation all together. This is something that can be handled 100% on the client side:

    <img src="#yourimage#" width="60" height="40" onerror="this.src='/images/nologo.png';">

  4. #4
    jcourtenay's Avatar
    jcourtenay is offline Guardian
    Join Date
    Jan 2011
    Location
    Wirral, UK
    Posts
    3,710
    Thanks
    22
    Thanked 19 Times in 19 Posts
    Feedback Score
    0

    Default

    I would put a description of what the image is, rather than just having the page display the words "No Image", it would greatly improve your SERP rankings.
    Free web space from Worlditsme, offering free web hosting packages and free php hosting

  5. #5
    kade is offline Banned
    Join Date
    Nov 2011
    Location
    USA
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    yes nice images i like it and post new images i hope its also fantastic dear...

Similar Threads

  1. Replies: 18
    Last Post: 03-03-2012, 11:39 PM
  2. Image Effects
    By yawez.com in forum HTML / DHTML
    Replies: 43
    Last Post: 12-04-2011, 11:41 AM
  3. Google image swirl
    By mamedesign in forum Google
    Replies: 0
    Last Post: 02-22-2010, 09:52 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Partners: BOSTON WEB DEVELOPER, LLC   |   WEBCOSMO CLASSIFIEDS