Gallery fails when image source contains an apostrophe character
  • All,

    I was just having a problem with the prettyPhoto gallery feature. The original image was something like:

    <img src="sam's birthday party.jpg">

    so when this image was getting inserted into the mini gallery it was showing a broken link because of the image source getting set like

    <img src='sam's birthday party.jpg>

    I downloaded the source code and changed the code where the data gets injected into the gallery. I though someone else might be able to save themselves some headache with this:
    Line 770 in jquery.prettyphoto.js

    toInject += "<li class='"+classname+"'><a href='#'><img src='" + img_src.replace(/'/g, ''') + "' width='50' alt='' /></a></li>";

    Notice the replacement of the single quote with the entity reference.
    Hope this helps someone or something like this makes it into the product.
    -Brett

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter