recently-viewed icon indicating copy to clipboard operation
recently-viewed copied to clipboard

Images are all broken

Open ergophobe opened this issue 10 years ago • 1 comments

When using this script, the image URL is generated as

//cdn.shopify.com/s/files/1/0642/0537/products/100_4774_medium.JPG

which is broken. If I'm on the product page, the image URL (correct) is //cdn.shopify.com/s/files/1/0642/0537/products/100_4774.JPG.w560h847_medium.jpg?v=1409808948

ergophobe avatar Sep 22 '14 05:09 ergophobe

This simply requires the match to be more specific so that if the string .jpg occurs in the middle of the string as well as the end, it matches only against the last one. So in the resizeImage function this

   var match  = src.match(/\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?/i);

becomes var match = src.match(/.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)($|?v=\d+)/i);

ergophobe avatar Sep 23 '14 01:09 ergophobe