Missing image in url

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Missing image in url

    Hi I have to retrieve images using <img
    src=http://www.othersite.com/graphics/thumbimages/#prefix#/#hotels.Id#-01.jpg></
    a> That works fine if in fact there is an image but the problem is when there
    is no image with the respective ID. Can someone suggest a work around if there
    is no image at the URL. Thanks

    DuLaus Guest

  2. Similar Questions and Discussions

    1. distiller missing text and image links when saving to pdf
      Your workflow is similar to bringing home a chinese takeaway, placing in a blender, then into the freezer, de-frosting and complaining it doesn't...
    2. Links missing/update dialog missing upon file open
      I am experiencing a strange problem when opening files with InDesign CS2. The usaul dialog box alerting you to missing/updated links does not appear....
    3. YouTube videos missing but there...what am I missing?
      Under my account of Guestdemo I had uploaded about 6 videos or so. I made them public and then made them private. When I go to my account it says...
    4. Missing Image when PDF is created.
      Using Adobe Photo Shop 7 on Mac OS 9.2.2 a clipping is done of a photo and saved as a TIFF. The TIFF is then placed onto a Quark 4.11 document. The...
    5. missing guides. missing cursors. missing a good drawing app. Ugh.
      I can't see my text cursor. It's invisible. Why? I can't see new guides I drag onto the documents. They are there, I just can't see them. Why? ...
  3. #2

    Default Re: Missing image in url

    Try:

    <cfif Isdefined('hotels.Id') AND hotels.Id NEQ "">
    <img
    src=http://www.othersite.com/graphics/thumbimages/#prefix#/#hotels.Id#-01.jpg>
    </cfif>

    Checks to see if it exists then makes sure that it is not empty.

    Tom

    ProWebService Guest

  4. #3

    Default Re: Missing image in url

    Hi ProWeb The #hotels.Id# is always going to be present for other data so it
    will always be true. When the image is not available I still get a broken
    image link showing. If I could use something like FileExists, but I only see
    reference examples to a path and not a URL. Thanks

    DuLaus Guest

  5. #4

    Default Re: Missing image in url

    bump
    DuLaus Guest

  6. #5

    Default Re: Missing image in url

    you could use javascript, something like:
    <script>
    var img1 = new Image() ;
    var imgAlt = new Image() ;
    img1.src =
    'http://www.othersite.com/graphics/thumbimages/#prefix#/#hotels.Id#-01.jpg';
    mgAlt.src = 'http://www.othersite.com/graphics/thumbimages/defaultImage.jpg';
    if(img1)
    myPic.src = img1.src;
    else
    myPic.src = imgAlt.src;
    </script>

    <img src="" name="myPic" id="myPic">

    kyle969 Guest

  7. #6

    Default Re: Missing image in url

    Check to see if the FileExists():



    <cfset hotelImage = ExpandPath('graphics/thumbimages/' & prefix) &
    "/#hotels.Id#-01.jpg">

    <cfif FileExists(hotelImage)>
    <img
    src="http://www.othersite.com/graphics/thumbimages/#prefix#/#hotels.Id#-01.jpg"
    />
    <cfelse>
    <img src="http://www.othersite.com/graphics/thumbimages/noImage.jpg" />
    </cfif>

    cf_menace Guest

  8. #7

    Default Re: Missing image in url

    Thanks for the posts. cf_menace <cfset hotelImage =
    ExpandPath('graphics/thumbimages/' &amp; prefix) &amp; '/#hotels.Id#-01.jpg'>
    I still have not figured out the above (I have not tried this code yet). Why
    am I setting a path to an image with the cfset statement when it is on another
    server. Thanks

    DuLaus Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139