Regenerate Thumbnails - Version 2.1.2

Version Description

Download this release

Release Info

Developer Viper007Bond
Plugin Icon 128x128 Regenerate Thumbnails
Version 2.1.2
Comparing to
See all releases

Code changes from version 2.1.0 to 2.1.2

readme.txt CHANGED
@@ -6,35 +6,42 @@ Requires at least: 2.8
6
  Tested up to: 3.0
7
  Stable tag: trunk
8
 
9
- Allows you to regenerate all thumbnails after changing the thumbnail sizes.
10
 
11
  == Description ==
12
 
13
- Regenerate Thumbnails allows you to regenerate the thumbnails for all of your image attachments. This is very handy if you've changed any of your thumbnail dimensions (via Settings -> Media) after previously uploading images.
14
 
15
- == Installation ==
16
-
17
- ###Updgrading From A Previous Version###
18
 
19
- To upgrade from a previous version of this plugin, delete the entire folder and files from the previous version of the plugin and then follow the installation instructions below.
20
 
21
- ###Installing The Plugin###
22
 
23
- Extract all files from the ZIP file, making sure to keep the file structure intact, and then upload it to `/wp-content/plugins/`.
 
 
 
24
 
25
- Then just visit your admin area and activate the plugin.
26
 
27
- ###Plugin Usage###
 
 
28
 
29
- Visit Tools -> Regen. Thumbnails to get started.
30
 
31
- **See Also:** ["Installing Plugins" article on the WP Codex](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins)
32
 
33
- == Screenshots ==
 
 
 
34
 
35
- 1. The plugin at work.
36
 
37
- == ChangeLog ==
 
38
 
39
  = Version 2.1.0 =
40
 
6
  Tested up to: 3.0
7
  Stable tag: trunk
8
 
9
+ Allows you to regenerate your thumbnails after changing the thumbnail sizes.
10
 
11
  == Description ==
12
 
13
+ Regenerate Thumbnails allows you to regenerate the thumbnails for your image attachments. This is very handy if you've changed any of your thumbnail dimensions (via Settings -> Media) after previously uploading images or have changed to a theme with different featured post image dimensions.
14
 
15
+ You can either regenerate the thumbnails for all image uploads, individual image uploads, or specific multiple image uploads (WordPress 3.1+ only).
 
 
16
 
17
+ See the [screenshots tab](http://wordpress.org/extend/plugins/regenerate-thumbnails/screenshots/) for more details.
18
 
19
+ == Installation ==
20
 
21
+ 1. Go to your admin area and select Plugins -> Add new from the menu.
22
+ 2. Search for "Regenerate Thumbnails".
23
+ 3. Click install.
24
+ 4. Click activate.
25
 
26
+ == Screenshots ==
27
 
28
+ 1. The plugin at work regenerating thumbnails
29
+ 2. You can resize single images by hovering over their row in the Media Library
30
+ 2. You can resize specific multiples images using the checkboxes and the "Bulk Actions" dropdown (WordPress 3.1+ only)
31
 
32
+ == ChangeLog ==
33
 
34
+ = Version 2.1.2 =
35
 
36
+ * When regenerating all images, newest images are done first rather than the oldest.
37
+ * Fixed a bug with regeneration error reporting in some browsers. Thanks to pete-sch for reporting the error.
38
+ * Supress PHP errors in the AJAX handler to avoid sending an invalid JSON response. Thanks to pete-sch for reporting the error.
39
+ * Better and more detailed error reporting for when `wp_generate_attachment_metadata()` fails.
40
 
41
+ = Version 2.1.1 =
42
 
43
+ * Clean up the wording a bit to better match the new features and just be easier to understand.
44
+ * Updated screenshots.
45
 
46
  = Version 2.1.0 =
47
 
regenerate-thumbnails.php CHANGED
@@ -5,7 +5,7 @@
5
  Plugin Name: Regenerate Thumbnails
6
  Plugin URI: http://www.viper007bond.com/wordpress-plugins/regenerate-thumbnails/
7
  Description: Allows you to regenerate all thumbnails after changing the thumbnail sizes.
8
- Version: 2.1.0
9
  Author: Viper007Bond
10
  Author URI: http://www.viper007bond.com/
11
 
@@ -144,7 +144,7 @@ class RegenerateThumbnails {
144
  // Directly querying the database is normally frowned upon, but all
145
  // of the API functions will return the full post objects which will
146
  // suck up lots of memory. This is best, just not as future proof.
147
- if ( ! $images = $wpdb->get_results( "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type LIKE 'image/%' ORDER BY ID" ) ) {
148
  echo ' <p>' . sprintf( __( "Unable to find any images. Are you sure <a href='%s'>some exist</a>?", 'regenerate-thumbnails' ), admin_url( 'upload.php?post_mime_type=image' ) ) . "</p></div>";
149
  return;
150
  }
@@ -273,7 +273,7 @@ class RegenerateThumbnails {
273
  RegenThumbsFinishUp();
274
  }
275
  },
276
- error: function() {
277
  RegenThumbsUpdateStatus( id, false, response );
278
 
279
  if ( rt_images.length && rt_continue ) {
@@ -299,9 +299,11 @@ class RegenerateThumbnails {
299
  <form method="post" action="">
300
  <?php wp_nonce_field('regenerate-thumbnails') ?>
301
 
302
- <p><?php printf( __( "Use this tool to regenerate thumbnails for all images that you have uploaded to your blog. This is useful if you've changed any of the thumbnail dimensions on the <a href='%s'>media settings page</a>. Old thumbnails will be kept to avoid any broken images due to hard-coded URLs.", 'regenerate-thumbnails' ), admin_url('options-media.php') ); ?></p>
303
 
304
- <p><?php _e( "This process is not reversible, although you can just change your thumbnail dimensions back to the old values and click the button again if you don't like the results.", 'regenerate-thumbnails' ); ?></p>
 
 
305
 
306
  <p><?php _e( 'To begin, just press the button below.', 'regenerate-thumbnails '); ?></p>
307
 
@@ -337,9 +339,13 @@ class RegenerateThumbnails {
337
  if ( false === $fullsizepath || ! file_exists( $fullsizepath ) )
338
  $this->die_json_error_msg( $image->ID, sprintf( __( 'The originally uploaded image file cannot be found at %s', 'regenerate-thumbnails' ), '<code>' . esc_html( $fullsizepath ) . '</code>' ) );
339
 
340
- set_time_limit( 900 );
 
341
 
342
  $metadata = wp_generate_attachment_metadata( $image->ID, $fullsizepath );
 
 
 
343
  if ( empty( $metadata ) )
344
  $this->die_json_error_msg( $image->ID, __( 'Unknown failure reason.', 'regenerate-thumbnails' ) );
345
 
5
  Plugin Name: Regenerate Thumbnails
6
  Plugin URI: http://www.viper007bond.com/wordpress-plugins/regenerate-thumbnails/
7
  Description: Allows you to regenerate all thumbnails after changing the thumbnail sizes.
8
+ Version: 2.1.2
9
  Author: Viper007Bond
10
  Author URI: http://www.viper007bond.com/
11
 
144
  // Directly querying the database is normally frowned upon, but all
145
  // of the API functions will return the full post objects which will
146
  // suck up lots of memory. This is best, just not as future proof.
147
+ if ( ! $images = $wpdb->get_results( "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type LIKE 'image/%' ORDER BY ID DESC" ) ) {
148
  echo ' <p>' . sprintf( __( "Unable to find any images. Are you sure <a href='%s'>some exist</a>?", 'regenerate-thumbnails' ), admin_url( 'upload.php?post_mime_type=image' ) ) . "</p></div>";
149
  return;
150
  }
273
  RegenThumbsFinishUp();
274
  }
275
  },
276
+ error: function( response ) {
277
  RegenThumbsUpdateStatus( id, false, response );
278
 
279
  if ( rt_images.length && rt_continue ) {
299
  <form method="post" action="">
300
  <?php wp_nonce_field('regenerate-thumbnails') ?>
301
 
302
+ <p><?php printf( __( "Use this tool to regenerate thumbnails for all images that you have uploaded to your blog. This is useful if you've changed any of the thumbnail dimensions on the <a href='%s'>media settings page</a>. Old thumbnails will be kept to avoid any broken images due to hard-coded URLs.", 'regenerate-thumbnails' ), admin_url( 'options-media.php' ) ); ?></p>
303
 
304
+ <p><?php printf( __( "You can regenerate specific images (rather than all images) from the <a href='%s'>Media</a> page. Hover over an image's row and click the link to resize just that one image or use the checkboxes and the &quot;Bulk Actions&quot; dropdown to resize multiple images (WordPress 3.1+ only).", 'regenerate-thumbnails '), admin_url( 'upload.php' ) ); ?></p>
305
+
306
+ <p><?php _e( "Thumbnail regeneration is not reversible, but you can just change your thumbnail dimensions back to the old values and click the button again if you don't like the results.", 'regenerate-thumbnails' ); ?></p>
307
 
308
  <p><?php _e( 'To begin, just press the button below.', 'regenerate-thumbnails '); ?></p>
309
 
339
  if ( false === $fullsizepath || ! file_exists( $fullsizepath ) )
340
  $this->die_json_error_msg( $image->ID, sprintf( __( 'The originally uploaded image file cannot be found at %s', 'regenerate-thumbnails' ), '<code>' . esc_html( $fullsizepath ) . '</code>' ) );
341
 
342
+ set_time_limit( 900 ); // 5 minutes per image should be PLENTY, lol
343
+ error_reporting( 0 ); // Don't break the JSON result
344
 
345
  $metadata = wp_generate_attachment_metadata( $image->ID, $fullsizepath );
346
+
347
+ if ( is_wp_error( $metadata ) )
348
+ $this->die_json_error_msg( $image->ID, $metadata->get_error_message() );
349
  if ( empty( $metadata ) )
350
  $this->die_json_error_msg( $image->ID, __( 'Unknown failure reason.', 'regenerate-thumbnails' ) );
351
 
screenshot-1.png CHANGED
Binary file
screenshot-2.png ADDED
Binary file
screenshot-3.png ADDED
Binary file