Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images are all broken #6

Open
ergophobe opened this issue Sep 22, 2014 · 1 comment
Open

Images are all broken #6

ergophobe opened this issue Sep 22, 2014 · 1 comment

Comments

@ergophobe
Copy link

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
Copy link
Author

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant