mindkomm / timmy

Advanced image handling for Timber.
MIT License
171 stars 13 forks source link

Resizing gone wrong since Timber 1.2.3 #9

Closed davidmaneuver closed 7 years ago

davidmaneuver commented 7 years ago

The TimberImage->src() method got refactored to use wp_get_attachment_url(). This returns the url of the thumbnail as a default. Which results in resizing the wrong image.

For example: /uploads/doge-150x150-c-default-1200x0-c-default.jpg

See my comment: https://github.com/timber/timber/commit/2b0c06a9fee2d9d30f22416309531188568f0d11

Changing

$file_src   = $timber_image->src();

to

$file_src   = $timber_image->src('original');

in Timmy.php line 314 fixes it for now.

gchtr commented 7 years ago

Hey @davidmaneuver, thanks a lot for looking into this issue!

As a quick fix I think it’s good to add the requested size explicitly. The src method now works with wp_get_attachment_image_src, which Timmy hooks into itself. This is a new behaviour that I have to look further into to make sure things are not overcomplicated and to check performance. Because of this, I’m not sure yet if Timber should always return the full size or the default size of wp_get_attachment_image_src, which is thumbnail.

The size original works, because Timmy allows it as an alias to full (the default name for the original size) for better compatibility with the WP SEO plugin.