bigcartel / dugway

Easily build and test Big Cartel themes.
https://developers.bigcartel.com/api/themes
MIT License
149 stars 22 forks source link

Image URLs not returning correctly with constrain filter. #147

Closed blamcam closed 8 years ago

blamcam commented 8 years ago

The "constrain" filter seems to break when only one dimension is provided like used in the "Nova" Big Cartel theme. For example: {{ image | product_image_url | constrain: '1000'}} produces a URL of:

path_to_image.jpg?h=0&w=1000

which causes an error a 402 error and a missing image in the browser. The correct path should return as:

path_to_image.jpg?w=1000

I added in a case statement in to deal with this but I'm not very familiar with ruby so I'm sure there's a more elegant solution.

mattwigham commented 8 years ago

Great catch. There's a new version of the gem out with this fix, you can grab it with gem install dugway. Happy theme-ing!