Skip to main content
Inspiring
June 15, 2009
Question

Space in Img File Name - Renders in FireFox but Not IE

  • June 15, 2009
  • 1 reply
  • 1642 views

I have an online store, some of the image file names have a space in them.  This still displays fine in FireFox but not in IE.  I tried to replace the space with a %20 thinking that this will render the image in IE and it still does not show in IE but will show in FireFox w/ the %20.

Here is my code:

<cfset sImage3 = "#reReplace(SImage,' ', '%20 ', 'all')#" >
                <IMG SRC="#Trim(sImage3)#" BORDER="0" >

Any suggestions?

    This topic has been closed for replies.

    1 reply

    Inspiring
    June 15, 2009

    Instead of a regular expression, try using the built-in function, URLEncodedFormat:

    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_t-z_10.html

    It should do the trick for you.

    AJBJAuthor
    Inspiring
    June 15, 2009

    I changed the code to read:  <IMG SRC="product-images/small/#URLEncodedFormat(Trim(sImage2))#" BORDER="0">

    The image still only displays in FireFox but not in IE.

    When looking at the source for the image it reads the following:

    FireFox: http://lightsunlimitedinc.com/product-images/small/4404%20GR%2EJPG

    IE: http://lightsunlimitedinc.com/product-images/small/4404%20GR.JPG

    Inspiring
    June 15, 2009

    That does seem to be the problem  I downloaded a couple of test images, opened them in PhotoShop and resaved/upload and I can now see the images.  the problem I have now is there are around 130,000 images that will need to be batched and saved and reuploaded.  Not looking forward to this.

    thanks


    Oh, man, that's brutal! Are you familiar with creating actions/batches in Photoshop? If not, check into them, it could save you some serious headache!!