Force Regenerate Thumbnails - Version 1.7

Version Description

  • Fix issue with getters path in Linux/Windows/Unix servers
Download this release

Release Info

Developer Pedro Elsner
Plugin Icon 128x128 Force Regenerate Thumbnails
Version 1.7
Comparing to
See all releases

Code changes from version 1.6 to 1.7

Files changed (2) hide show
  1. force-regenerate-thumbnails.php +11 -7
  2. readme.txt +3 -0
force-regenerate-thumbnails.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Force Regenerate Thumbnails
4
  Plugin URI: http://pedroelsner.com/2012/08/forcando-a-atualizacao-de-thumbnails-no-wordpress
5
  Description: Delete and REALLY force the regenerate thumbnail.
6
- Version: 1.6
7
  Author: Pedro Elsner
8
  Author URI: http://www.pedroelsner.com/
9
  */
@@ -438,10 +438,14 @@ class ForceRegenerateThumbnails {
438
  return;
439
  }
440
 
441
- $fullsizepath = get_attached_file($image->ID);
 
 
 
 
442
 
443
- if (false === $fullsizepath || !file_exists($fullsizepath)) {
444
- $this->die_json_error_msg($image->ID, sprintf( __('<span style="color: #FF3366;">The originally uploaded image file cannot be found at %s</span>', 'force-regenerate-thumbnails'), '<code>' . esc_html($fullsizepath) . '</code>'));
445
  return;
446
  }
447
 
@@ -461,9 +465,9 @@ class ForceRegenerateThumbnails {
461
  * New CORE 1.6 version
462
  */
463
  $thumbnails = array();
464
- $file_info = pathinfo($fullsizepath);
465
 
466
- $message = '<br /> - Original file: ' . realpath($fullsizepath);
467
 
468
  // Hack to find thumbnail
469
  $file_info['filename'] .= '-';
@@ -491,7 +495,7 @@ class ForceRegenerateThumbnails {
491
  /**
492
  * Regenerate
493
  */
494
- $metadata = wp_generate_attachment_metadata($image->ID, $fullsizepath);
495
 
496
  if (is_wp_error($metadata)) {
497
  $this->die_json_error_msg($image->ID, $metadata->get_error_message());
3
  Plugin Name: Force Regenerate Thumbnails
4
  Plugin URI: http://pedroelsner.com/2012/08/forcando-a-atualizacao-de-thumbnails-no-wordpress
5
  Description: Delete and REALLY force the regenerate thumbnail.
6
+ Version: 1.7
7
  Author: Pedro Elsner
8
  Author URI: http://www.pedroelsner.com/
9
  */
438
  return;
439
  }
440
 
441
+ $image_fullpath = get_attached_file($image->ID);
442
+ $upload_dir = get_option('upload_path');
443
+ if ((strrpos($image_fullpath, $upload_dir) === false)) {
444
+ $image_fullpath = realpath($upload_dir . DIRECTORY_SEPARATOR . $image_fullpath);
445
+ }
446
 
447
+ if (false === $image_fullpath || !file_exists($image_fullpath)) {
448
+ $this->die_json_error_msg($image->ID, sprintf( __('<span style="color: #FF3366;">The originally uploaded image file cannot be found at %s</span>', 'force-regenerate-thumbnails'), '<code>' . esc_html($image_fullpath) . '</code>'));
449
  return;
450
  }
451
 
465
  * New CORE 1.6 version
466
  */
467
  $thumbnails = array();
468
+ $file_info = pathinfo($image_fullpath);
469
 
470
+ $message = '<br /> - Original file: ' . realpath($image_fullpath);
471
 
472
  // Hack to find thumbnail
473
  $file_info['filename'] .= '-';
495
  /**
496
  * Regenerate
497
  */
498
+ $metadata = wp_generate_attachment_metadata($image->ID, $image_fullpath);
499
 
500
  if (is_wp_error($metadata)) {
501
  $this->die_json_error_msg($image->ID, $metadata->get_error_message());
readme.txt CHANGED
@@ -30,6 +30,9 @@ See the [screenshots tab](http://wordpress.org/extend/plugins/force-regenerate-t
30
 
31
  == ChangeLog ==
32
 
 
 
 
33
  = 1.6 =
34
  * New CORE to regenerate thumbnails
35
 
30
 
31
  == ChangeLog ==
32
 
33
+ = 1.7 =
34
+ * Fix issue with getters path in Linux/Windows/Unix servers
35
+
36
  = 1.6 =
37
  * New CORE to regenerate thumbnails
38