gambitph / WP-OTF-Regenerate-Thumbnails

Automatically regenerates your thumbnails on the fly when thumbnail sizes change.
https://wordpress.org/plugins/otf-regenerate-thumbnails/
GNU General Public License v2.0
77 stars 16 forks source link

Always Resizing Thumbnail with Set Height but No Width #13

Closed kylelarkin closed 9 years ago

kylelarkin commented 9 years ago

I have a need for a specific thumbnail to always be soft cropped to a specific height but to allow any width. To accomplish this I'm using add_image_size and specifying a 0 width but a set height, like this: add_image_size( 'project-type', 0, 350, false );

OTF is re-cropping the thumbnails on every page load even though they already exist. I think it has something to do with the width not being set in the image meta data but I'm not sure. If I change the thumbnail size to have a consistent height and width everything seems fine.

eoutvik commented 9 years ago

Check out the pull request I made for this plugin. You can accomplish a "free width" resize by passing a huge width parameter and setting crop to false:

wp_get_attachment_image_src( $attachment_id, array(9999, 350, false));
oherman commented 9 years ago

Since the problem is fixed with this contribution, this is considered closed.

kylelarkin commented 9 years ago

While the pull request does allow images to be "free width" resized, the issue remains that those images are being re-cropped on every page load. I think because the detection logic of the plugin is checking for matching widths first, rather than matching heights, it thinks the existing thumbnails don't match anything in the system. Therefore, it's re-cropping them each time.

oherman commented 9 years ago

Hmm that does sound odd indeed. We'll check it out.

On Mon, Jul 20, 2015 at 2:40 PM, Kyle Larkin notifications@github.com wrote:

While the pull request does allow images to be "free width" resized, the issue remains that those images are being re-cropped on every page load. I think because the detection logic of the plugin is checking for matching widths first, rather than matching heights, it thinks the existing thumbnails don't match anything in the system. Therefore, it's re-cropping them each time.

— Reply to this email directly or view it on GitHub https://github.com/gambitph/WP-OTF-Regenerate-Thumbnails/issues/13#issuecomment-122776061 .

kylelarkin commented 9 years ago

Great. Thanks! I think this plugin is fantastic and if it were built into WP core it would save every site GBs of storage every month. Thanks again for all your efforts.