• hi viper,
    regenerate thumbnail is a great plugin and it helps big time in my project. However, i need to delete the delete the old thumbnails, which are previously generated.
    we change our theme often and according to our needs the thumbnail size would also be changed(drastically), so i need to delete the old thumbnail images previously generated using the plugin.
    currently i do it manually by accessing my cpanel, is their any other way to do it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Regenerate Thumbnails – Version 2.2.0

    In file regenerate-thumbnails.php locate this, at line 357:

    @set_time_limit( 900 ); // 5 minutes per image should be PLENTY
    
    $metadata = wp_generate_attachment_metadata( $image->ID, $fullsizepath );

    Add this block of code between the two lines:

    @set_time_limit( 900 ); // 5 minutes per image should be PLENTY
    
    // find and delete any previous image-sizes
    $info = pathinfo($fullsizepath);
    $ext = $info['extension'];
    $pattern = str_replace(".$ext", "-*x*.$ext", $fullsizepath);
    foreach (glob($pattern) as $filename) {
    	@unlink($filename);
    }
    
    $metadata = wp_generate_attachment_metadata( $image->ID, $fullsizepath );

    This will delete any previously generated image-sizes, including older outdated sizes before creating the new sizes.

    Important: Note that URLs to images are hard-coded in posts and pages. Removing old thumbnails could result in broken images if they are still used somewhere on your site. You have been warned…

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

    Find more details in forum of plugin-developer…

    You can try with this plugin DNUI

    afublog

    (@afublog)

    @ov3rfly:

    Your code will be fail if I have an image which has the following name:

    helloworld-abcxdef.jpg

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to delete old thumbnail images’ is closed to new replies.