WordPress.org

Ready to get started?Download WordPress

Forums

Regenerate Thumbnails
Suggestion/request/beg: auto-regenerate (7 posts)

  1. Biranit
    Member
    Posted 2 years ago #

    Hi,

    I would really really really really love it if there was a way to automatically run "regenerate thumbnails" automatically after an image was edited in the edit media thickbox. This way, when an editor uploads an image and crops it, for example, then he doesn't have to leave the article page and go to the media library in order to regenerate thumbnails for an image he just uploaded.

    This is a necessity, because silly WordPress core does not handle custom image sizes when you, for example, crop an image. Although it says "apply all changes to all sizes" - it in fact does not do that for the sizes added via add_image_size().... So the Regenerate Thumbails plugin is really my only hope :/

    So can I beg? :)

    Thanks!

    Bira

    http://wordpress.org/extend/plugins/regenerate-thumbnails/

  2. harryrobbins
    Member
    Posted 2 years ago #

    I agree it would be a really useful feature.

    You can make it happen without the plugin by adding the following to functions.php

    add_action('image_save_pre', 'add_image_options');
    function add_image_options($data){
    	global $_wp_additional_image_sizes;
    	foreach($_wp_additional_image_sizes as $size => $properties){
    		update_option($size."_size_w", $properties['width']);
    		update_option($size."_size_h", $properties['height']);
    		update_option($size."_crop", $properties['crop']);
    	}
    	return $data;
    }

    Hope that helps,

    Harry

  3. idotpdot
    Member
    Posted 2 years ago #

    I am running into this issue right now as well and would also agree that this would be a great feature addition for the plugin (and to core!), even if it at minimum there was a "Regenerate Thumbnail" link in post's media window.

  4. idotpdot
    Member
    Posted 2 years ago #

    @harryrobbins ps, thanks for that snippet- totally did the trick.

    Was a difficult support post to find (spent a few hours looking for the answer), so here are some search tags/content to help future users out: "regenerate and save custom thumbnails and custom image sizes after crop in WordPress image editor".

  5. Biranit
    Member
    Posted 2 years ago #

    Hi Harry,

    Many thanks for this snippet. I am going to add it and see how it goes.

    Very much appreciate your assistance.

    Best,

    Bira

  6. linjian001
    Member
    Posted 1 year ago #

    Can we make the functions of Regenerate Thumbnails available not only for the role of administrator but also the role of author and editor in the media gallery?

  7. linjian001
    Member
    Posted 1 year ago #

    When we add the code below to the theme's functions.php, then we can make the thumbnails to be auto-regenerated,really? Really wonderful!

    add_action('image_save_pre', 'add_image_options');
    function add_image_options($data){
    	global $_wp_additional_image_sizes;
    	foreach($_wp_additional_image_sizes as $size => $properties){
    		update_option($size."_size_w", $properties['width']);
    		update_option($size."_size_h", $properties['height']);
    		update_option($size."_crop", $properties['crop']);
    	}
    	return $data;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic