joeyvandijk / rimg

[DEPRECATED] A responsive image solution for browsers that support mediaqueries. Pure javascript and no server-side code.
http://joeyvandijk.github.io/rimg
MIT License
294 stars 25 forks source link

Filenaming issue #10

Closed jacmaes closed 10 years ago

jacmaes commented 10 years ago

Hi again,

I'm having an issue with my image filenames, which are not recognized when automatically generated from my CMS. Instead of "-small", "-medium", etc, my CMS places the following suffix: ".320x0", ".640x0", etc. I cannot easily change this output, nor do I want to really. If I remove the last two characters ("x0"), everything works fine. But if I leave it as is, the filename suffix that rimg adds is "undefined", e.g. "my-imageundefined.jpg".

joeyvandijk commented 10 years ago

Rule 134 in rimg.js shows that it matches the string to find the 1x, 2x, 3x, 4x (pixelratio), but with your setup it also matches that. So no url-type (-small, -medium, -big) is recognized. If you update that line with a RegExp that matches your situation it will work. Ensure that all 3 parts are recognized (currently only 2 are recognized in your setup).

I will have a look at the setup, but have no time this/next week.

jacmaes commented 10 years ago

Thanks, no rush of course. It would be great if you have time to take a look at it over the summer.

joeyvandijk commented 10 years ago

Fixed with v1.7.0, just some hours and it will pop up on cdnjs.com.