reGenerate Thumbnails Advanced - Version 1.1.3

Version Description

Download this release

Release Info

Developer turcuciprian
Plugin Icon 128x128 reGenerate Thumbnails Advanced
Version 1.1.3
Comparing to
See all releases

Code changes from version 1.1.2 to 1.1.3

abExport.php CHANGED
@@ -5,7 +5,6 @@
5
  include_once ABSPATH.'wp-admin/includes/plugin.php';
6
  if (!function_exists('ab_admin_notice_success')) {
7
  if (!is_plugin_active('admin-builder/admin-builder.php')) {
8
-
9
  function ab_admin_notice_success()
10
  {
11
  $pluginInstalled = false;
@@ -50,7 +49,7 @@
50
  echo '</div>';
51
  }
52
  }
53
- add_action('admin_notices', 'sample_admin_notice__success');
54
  }
55
  }
56
  if (!$abError) {
5
  include_once ABSPATH.'wp-admin/includes/plugin.php';
6
  if (!function_exists('ab_admin_notice_success')) {
7
  if (!is_plugin_active('admin-builder/admin-builder.php')) {
 
8
  function ab_admin_notice_success()
9
  {
10
  $pluginInstalled = false;
49
  echo '</div>';
50
  }
51
  }
52
+ add_action('admin_notices', 'ab_admin_notice_success');
53
  }
54
  }
55
  if (!$abError) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: regenerate, thumbnails, advanced, easy, day, weeek, month
5
  Requires at least: 3.1
6
  Tested up to: 4.4.1
7
- Stable tag: 1.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -106,6 +106,12 @@ Added donate button
106
  = 1.1 =
107
  Added Admin builder plugin dependency and functionality.
108
 
 
 
 
 
 
 
109
 
110
  == Upgrade Notice ==
111
 
@@ -153,3 +159,9 @@ nothing that affect the previous data is changed. Update is save
153
 
154
  = 1.1 =
155
  Database field is saved someplace else now. It needs to be configured again. Basically just go into settings, click to activate and click save.
 
 
 
 
 
 
4
  Tags: regenerate, thumbnails, advanced, easy, day, weeek, month
5
  Requires at least: 3.1
6
  Tested up to: 4.4.1
7
+ Stable tag: 1.1.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
106
  = 1.1 =
107
  Added Admin builder plugin dependency and functionality.
108
 
109
+ =1.1.2=
110
+ Important bugfixes
111
+
112
+ =1.1.3=
113
+ Important bugfixes
114
+
115
 
116
  == Upgrade Notice ==
117
 
159
 
160
  = 1.1 =
161
  Database field is saved someplace else now. It needs to be configured again. Basically just go into settings, click to activate and click save.
162
+
163
+ =1.1.2=
164
+ Important bugfixes
165
+
166
+ =1.1.3=
167
+ Important bugfixes
regenerate-thumbnails-advanced.php CHANGED
@@ -3,12 +3,13 @@
3
  Plugin Name: reGenerate Thumbnails - advanced
4
  Plugin URI: http://turcuciprian.com
5
  Description: A plugin that makes regenerating thumbnails even easier than before and more flexible.
6
- Version: 1.1.1
7
  Author: turcuciprian
8
  Author URI: http://turcuciprian.com
9
  License: GPLv2 or later
10
  Text Domain: RTA
11
  */
 
12
  add_action('admin_enqueue_scripts', 'enqueue_admin');
13
 
14
  function enqueue_admin($hook)
@@ -27,152 +28,152 @@ add_action('init', 'rtaInit');
27
  function rtaInit()
28
  {
29
  global $abGen;
30
- if (!function_exists($abGen,'getField')) {
31
  return true;
32
  }
33
  $rotf = $abGen->getField('abOption_cPage_regenerateThumbnailsAdvanced', 'tab1', 'rtaOTF');
34
  if (!function_exists('gambit_otf_regen_thumbs_media_downsize') && $rotf == 'on') {
35
  add_filter('image_downsize', 'gambit_otf_regen_thumbs_media_downsize', 10, 3);
36
 
37
- /**
38
- * The downsizer. This only does something if the existing image size doesn't exist yet.
39
- *
40
- * @param $out boolean false
41
- * @param $id int Attachment ID
42
- * @param $size mixed The size name, or an array containing the width & height
43
- *
44
- * @return mixed False if the custom downsize failed, or an array of the image if successful
45
- */
46
- function gambit_otf_regen_thumbs_media_downsize($out, $id, $size)
47
- {
48
-
49
- // Gather all the different image sizes of WP (thumbnail, medium, large) and,
50
- // all the theme/plugin-introduced sizes.
51
- global $_gambit_otf_regen_thumbs_all_image_sizes;
52
- if (!isset($_gambit_otf_regen_thumbs_all_image_sizes)) {
53
- global $_wp_additional_image_sizes;
54
-
55
- $_gambit_otf_regen_thumbs_all_image_sizes = array();
56
- $interimSizes = get_intermediate_image_sizes();
57
-
58
- foreach ($interimSizes as $sizeName) {
59
- if (in_array($sizeName, array('thumbnail', 'medium', 'large'))) {
60
- $_gambit_otf_regen_thumbs_all_image_sizes[ $sizeName ]['width'] = get_option($sizeName.'_size_w');
61
- $_gambit_otf_regen_thumbs_all_image_sizes[ $sizeName ]['height'] = get_option($sizeName.'_size_h');
62
- $_gambit_otf_regen_thumbs_all_image_sizes[ $sizeName ]['crop'] = (bool) get_option($sizeName.'_crop');
63
- } elseif (isset($_wp_additional_image_sizes[ $sizeName ])) {
64
- $_gambit_otf_regen_thumbs_all_image_sizes[ $sizeName ] = $_wp_additional_image_sizes[ $sizeName ];
65
- }
 
 
66
  }
67
  }
 
68
 
69
- // This now contains all the data that we have for all the image sizes
70
- $allSizes = $_gambit_otf_regen_thumbs_all_image_sizes;
71
 
72
- // If image size exists let WP serve it like normally
73
- $imagedata = wp_get_attachment_metadata($id);
 
 
 
 
 
74
 
75
- // Image attachment doesn't exist
76
- if (!is_array($imagedata)) {
 
 
 
77
  return false;
78
  }
79
 
80
- // If the size given is a string / a name of a size
81
- if (is_string($size)) {
82
 
83
- // If WP doesn't know about the image size name, then we can't really do any resizing of our own
84
- if (empty($allSizes[ $size ])) {
 
85
  return false;
86
  }
87
 
88
- // If the size has already been previously created, use it
89
- if (!empty($imagedata['sizes'][ $size ]) && !empty($allSizes[ $size ])) {
90
-
91
- // But only if the size remained the same
92
- if ($allSizes[ $size ]['width'] == $imagedata['sizes'][ $size ]['width']
93
- && $allSizes[ $size ]['height'] == $imagedata['sizes'][ $size ]['height']) {
94
  return false;
95
  }
96
-
97
- // Or if the size is different and we found out before that the size really was different
98
- if (!empty($imagedata['sizes'][ $size ][ 'width_query' ])
99
- && !empty($imagedata['sizes'][ $size ]['height_query'])) {
100
- if ($imagedata['sizes'][ $size ]['width_query'] == $allSizes[ $size ]['width']
101
- && $imagedata['sizes'][ $size ]['height_query'] == $allSizes[ $size ]['height']) {
102
- return false;
103
- }
104
- }
105
  }
 
106
 
107
- // Resize the image
108
- $resized = image_make_intermediate_size(
109
- get_attached_file($id),
110
- $allSizes[ $size ]['width'],
111
- $allSizes[ $size ]['height'],
112
- $allSizes[ $size ]['crop']
113
- );
114
-
115
- // Resize somehow failed
116
- if (!$resized) {
117
- return false;
118
- }
119
 
120
- // Save the new size in WP
121
- $imagedata['sizes'][ $size ] = $resized;
 
 
122
 
123
- // Save some additional info so that we'll know next time whether we've resized this before
124
- $imagedata['sizes'][ $size ]['width_query'] = $allSizes[ $size ]['width'];
125
- $imagedata['sizes'][ $size ]['height_query'] = $allSizes[ $size ]['height'];
126
 
127
- wp_update_attachment_metadata($id, $imagedata);
 
 
128
 
129
- // Serve the resized image
130
- $att_url = wp_get_attachment_url($id);
131
 
132
- return array(dirname($att_url).'/'.$resized['file'], $resized['width'], $resized['height'], true);
 
133
 
134
- // If the size given is a custom array size
135
- } elseif (is_array($size)) {
136
- $imagePath = get_attached_file($id);
137
 
138
- // This would be the path of our resized image if the dimensions existed
139
- $imageExt = pathinfo($imagePath, PATHINFO_EXTENSION);
140
- $imagePath = preg_replace('/^(.*)\.'.$imageExt.'$/', sprintf('$1-%sx%s.%s', $size[0], $size[1], $imageExt), $imagePath);
141
 
142
- $att_url = wp_get_attachment_url($id);
 
 
143
 
144
- // If it already exists, serve it
145
- if (file_exists($imagePath)) {
146
- return array(dirname($att_url).'/'.basename($imagePath), $size[0], $size[1], true);
147
- }
148
 
149
- // If not, resize the image...
150
- $resized = image_make_intermediate_size(
151
- get_attached_file($id),
152
- $size[0],
153
- $size[1],
154
- true
155
- );
156
 
157
- // Get attachment meta so we can add new size
158
- $imagedata = wp_get_attachment_metadata($id);
 
 
 
 
 
159
 
160
- // Save the new size in WP so that it can also perform actions on it
161
- $imagedata['sizes'][ $size[0].'x'.$size[1] ] = $resized;
162
- wp_update_attachment_metadata($id, $imagedata);
163
 
164
- // Resize somehow failed
165
- if (!$resized) {
166
- return false;
167
- }
168
 
169
- // Then serve it
170
- return array(dirname($att_url).'/'.$resized['file'], $resized['width'], $resized['height'], true);
 
171
  }
172
 
173
- return false;
174
- }
175
  }
176
- }
177
 
178
- include('abExport.php');
 
 
3
  Plugin Name: reGenerate Thumbnails - advanced
4
  Plugin URI: http://turcuciprian.com
5
  Description: A plugin that makes regenerating thumbnails even easier than before and more flexible.
6
+ Version: 1.1.3
7
  Author: turcuciprian
8
  Author URI: http://turcuciprian.com
9
  License: GPLv2 or later
10
  Text Domain: RTA
11
  */
12
+
13
  add_action('admin_enqueue_scripts', 'enqueue_admin');
14
 
15
  function enqueue_admin($hook)
28
  function rtaInit()
29
  {
30
  global $abGen;
31
+ if (!function_exists($abGen, 'getField')) {
32
  return true;
33
  }
34
  $rotf = $abGen->getField('abOption_cPage_regenerateThumbnailsAdvanced', 'tab1', 'rtaOTF');
35
  if (!function_exists('gambit_otf_regen_thumbs_media_downsize') && $rotf == 'on') {
36
  add_filter('image_downsize', 'gambit_otf_regen_thumbs_media_downsize', 10, 3);
37
 
38
+
39
+ }
40
+ }
41
+ /**
42
+ * The downsizer. This only does something if the existing image size doesn't exist yet.
43
+ *
44
+ * @param $out boolean false
45
+ * @param $id int Attachment ID
46
+ * @param $size mixed The size name, or an array containing the width & height
47
+ *
48
+ * @return mixed False if the custom downsize failed, or an array of the image if successful
49
+ */
50
+ function gambit_otf_regen_thumbs_media_downsize($out, $id, $size)
51
+ {
52
+
53
+ // Gather all the different image sizes of WP (thumbnail, medium, large) and,
54
+ // all the theme/plugin-introduced sizes.
55
+ global $_gambit_otf_regen_thumbs_all_image_sizes;
56
+ if (!isset($_gambit_otf_regen_thumbs_all_image_sizes)) {
57
+ global $_wp_additional_image_sizes;
58
+
59
+ $_gambit_otf_regen_thumbs_all_image_sizes = array();
60
+ $interimSizes = get_intermediate_image_sizes();
61
+
62
+ foreach ($interimSizes as $sizeName) {
63
+ if (in_array($sizeName, array('thumbnail', 'medium', 'large'))) {
64
+ $_gambit_otf_regen_thumbs_all_image_sizes[ $sizeName ]['width'] = get_option($sizeName.'_size_w');
65
+ $_gambit_otf_regen_thumbs_all_image_sizes[ $sizeName ]['height'] = get_option($sizeName.'_size_h');
66
+ $_gambit_otf_regen_thumbs_all_image_sizes[ $sizeName ]['crop'] = (bool) get_option($sizeName.'_crop');
67
+ } elseif (isset($_wp_additional_image_sizes[ $sizeName ])) {
68
+ $_gambit_otf_regen_thumbs_all_image_sizes[ $sizeName ] = $_wp_additional_image_sizes[ $sizeName ];
69
  }
70
  }
71
+ }
72
 
73
+ // This now contains all the data that we have for all the image sizes
74
+ $allSizes = $_gambit_otf_regen_thumbs_all_image_sizes;
75
 
76
+ // If image size exists let WP serve it like normally
77
+ $imagedata = wp_get_attachment_metadata($id);
78
+
79
+ // Image attachment doesn't exist
80
+ if (!is_array($imagedata)) {
81
+ return false;
82
+ }
83
 
84
+ // If the size given is a string / a name of a size
85
+ if (is_string($size)) {
86
+
87
+ // If WP doesn't know about the image size name, then we can't really do any resizing of our own
88
+ if (empty($allSizes[ $size ])) {
89
  return false;
90
  }
91
 
92
+ // If the size has already been previously created, use it
93
+ if (!empty($imagedata['sizes'][ $size ]) && !empty($allSizes[ $size ])) {
94
 
95
+ // But only if the size remained the same
96
+ if ($allSizes[ $size ]['width'] == $imagedata['sizes'][ $size ]['width']
97
+ && $allSizes[ $size ]['height'] == $imagedata['sizes'][ $size ]['height']) {
98
  return false;
99
  }
100
 
101
+ // Or if the size is different and we found out before that the size really was different
102
+ if (!empty($imagedata['sizes'][ $size ][ 'width_query' ])
103
+ && !empty($imagedata['sizes'][ $size ]['height_query'])) {
104
+ if ($imagedata['sizes'][ $size ]['width_query'] == $allSizes[ $size ]['width']
105
+ && $imagedata['sizes'][ $size ]['height_query'] == $allSizes[ $size ]['height']) {
 
106
  return false;
107
  }
 
 
 
 
 
 
 
 
 
108
  }
109
+ }
110
 
111
+ // Resize the image
112
+ $resized = image_make_intermediate_size(
113
+ get_attached_file($id),
114
+ $allSizes[ $size ]['width'],
115
+ $allSizes[ $size ]['height'],
116
+ $allSizes[ $size ]['crop']
117
+ );
 
 
 
 
 
118
 
119
+ // Resize somehow failed
120
+ if (!$resized) {
121
+ return false;
122
+ }
123
 
124
+ // Save the new size in WP
125
+ $imagedata['sizes'][ $size ] = $resized;
 
126
 
127
+ // Save some additional info so that we'll know next time whether we've resized this before
128
+ $imagedata['sizes'][ $size ]['width_query'] = $allSizes[ $size ]['width'];
129
+ $imagedata['sizes'][ $size ]['height_query'] = $allSizes[ $size ]['height'];
130
 
131
+ wp_update_attachment_metadata($id, $imagedata);
 
132
 
133
+ // Serve the resized image
134
+ $att_url = wp_get_attachment_url($id);
135
 
136
+ return array(dirname($att_url).'/'.$resized['file'], $resized['width'], $resized['height'], true);
 
 
137
 
138
+ // If the size given is a custom array size
139
+ } elseif (is_array($size)) {
140
+ $imagePath = get_attached_file($id);
141
 
142
+ // This would be the path of our resized image if the dimensions existed
143
+ $imageExt = pathinfo($imagePath, PATHINFO_EXTENSION);
144
+ $imagePath = preg_replace('/^(.*)\.'.$imageExt.'$/', sprintf('$1-%sx%s.%s', $size[0], $size[1], $imageExt), $imagePath);
145
 
146
+ $att_url = wp_get_attachment_url($id);
 
 
 
147
 
148
+ // If it already exists, serve it
149
+ if (file_exists($imagePath)) {
150
+ return array(dirname($att_url).'/'.basename($imagePath), $size[0], $size[1], true);
151
+ }
 
 
 
152
 
153
+ // If not, resize the image...
154
+ $resized = image_make_intermediate_size(
155
+ get_attached_file($id),
156
+ $size[0],
157
+ $size[1],
158
+ true
159
+ );
160
 
161
+ // Get attachment meta so we can add new size
162
+ $imagedata = wp_get_attachment_metadata($id);
 
163
 
164
+ // Save the new size in WP so that it can also perform actions on it
165
+ $imagedata['sizes'][ $size[0].'x'.$size[1] ] = $resized;
166
+ wp_update_attachment_metadata($id, $imagedata);
 
167
 
168
+ // Resize somehow failed
169
+ if (!$resized) {
170
+ return false;
171
  }
172
 
173
+ // Then serve it
174
+ return array(dirname($att_url).'/'.$resized['file'], $resized['width'], $resized['height'], true);
175
  }
 
176
 
177
+ return false;
178
+ }
179
+ include 'abExport.php';
trunk/README.md DELETED
@@ -1,2 +0,0 @@
1
- # regenerate-thumbnails-advanced
2
- Generates Thumbnails for the old uploaded images according to the theme required image sizes - advanced functionality
 
 
trunk/abExport.php DELETED
@@ -1,64 +0,0 @@
1
- <?php
2
-
3
-
4
- $abError = false;
5
- include_once ABSPATH.'wp-admin/includes/plugin.php';
6
- if (!function_exists('ab_admin_notice_success')) {
7
- if (!is_plugin_active('admin-builder/admin-builder.php')) {
8
-
9
- function ab_admin_notice_success()
10
- {
11
- $pluginInstalled = false;
12
- if (!function_exists('get_plugins')) {
13
- require_once ABSPATH.'wp-admin/includes/plugin.php';
14
- }
15
- $allPlugins = get_plugins();
16
- foreach ($allPlugins as $key => $value) {
17
- if ($key === 'admin-builder/admin_builder.php') {
18
- $pluginInstalled = true;
19
- }
20
- # code...
21
- }
22
- if (isset($_GET['action']) && $_GET['action'] === 'install-plugin' && isset($_GET['plugin']) && $_GET['plugin'] === 'admin-builder') {
23
- return;
24
- }
25
- if ($pluginInstalled) {
26
- //check if plugin is activated:
27
- $abError = true;
28
- $url = admin_url();
29
-
30
- echo '<div class="notice notice-error is-dismissible">';
31
- echo '<h3>Step 3(final): Activate Admin Builder!</h3>';
32
- echo '<p>';
33
- echo 'To get the full functionality , activate Admin Builder from the <a href="'.$url.'/plugins.php"><span class="button-primary">plugins directory</span></a>.';
34
- echo '</p>';
35
- echo '</div>';
36
- //plugin is activated
37
- } else {
38
- $abError = true;
39
- echo '<div class="notice notice-error is-dismissible">';
40
- echo '<h3>Step 2: Install Admin Builder</h3>';
41
- echo '<p>';
42
- echo 'To get the full functionality , install Admin Builder.';
43
- echo '</p>';
44
- echo '<p>';
45
- $plugin_name = 'admin-builder';
46
- $install_link = '<a href="'.esc_url(network_admin_url('plugin-install.php?tab=plugin-information&amp;plugin='.$plugin_name.'&amp;TB_iframe=true&amp;width=600&amp;height=550')).'" class="thickbox" title="More info about '.$plugin_name.'"><span class="button-primary">Install '.$plugin_name.'</span></a>';
47
-
48
- echo $install_link;
49
- echo '</p>';
50
- echo '</div>';
51
- }
52
- }
53
- add_action('admin_notices', 'ab_admin_notice_success');
54
- }
55
- }
56
- if (!$abError) {
57
- if (!$abError) {
58
- if (class_exists('loadFromPlugin')) {
59
- $theJson = '{"menus":[{"label":"Posts","type":"post","name":"posts","unique":true,"children":[],"$$hashKey":"object:66"},{"label":"Pages","type":"page","name":"pages","unique":true,"children":[],"$$hashKey":"object:67"},{"label":"Reg. Thumbnails","type":"cPage","name":"regenerateThumbnailsAdvanced","unique":false,"children":[{"label":"General Settings","name":"tab1","context":"normal","priority":"default","fields":[{"name":"rtaOTF","type":"checkbox","label":"Auto Regenerate","description":"Check this if you want missing thumbnails to be created on the fly, when needed.","extraText":"Activate","$$hashKey":"object:293"}],"$$hashKey":"object:92"}],"capability":"manage_options","handler":"ab_regenerateThumbnailsAdvanced","pageTitle":"regenerate Thumbnails Settings","$$hashKey":"object:89","pageDescription":"Configure if you want to regenerate thumbnails on the fly or not. Just make sure to check the checkbox if you do want everything to be taken care of regarding unexisting plugins."}]}';
60
- $lfp = new loadFromPlugin();
61
- $lfp->load($theJson);
62
- }
63
- }
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/images/ui-bg_flat_30_cccccc_40x100.png DELETED
Binary file
trunk/images/ui-bg_flat_50_5c5c5c_40x100.png DELETED
Binary file
trunk/images/ui-bg_glass_20_555555_1x400.png DELETED
Binary file
trunk/images/ui-bg_glass_40_0078a3_1x400.png DELETED
Binary file
trunk/images/ui-bg_glass_40_ffc73d_1x400.png DELETED
Binary file
trunk/images/ui-bg_gloss-wave_25_333333_500x100.png DELETED
Binary file
trunk/images/ui-bg_highlight-soft_80_eeeeee_1x100.png DELETED
Binary file
trunk/images/ui-bg_inset-soft_25_000000_1x100.png DELETED
Binary file
trunk/images/ui-bg_inset-soft_30_f58400_1x100.png DELETED
Binary file
trunk/images/ui-icons_222222_256x240.png DELETED
Binary file
trunk/images/ui-icons_4b8e0b_256x240.png DELETED
Binary file
trunk/images/ui-icons_a83300_256x240.png DELETED
Binary file
trunk/images/ui-icons_cccccc_256x240.png DELETED
Binary file
trunk/images/ui-icons_ffffff_256x240.png DELETED
Binary file
trunk/readme.txt DELETED
@@ -1,155 +0,0 @@
1
- === reGenerate Thumbnails Advanced ===
2
- Contributors: turcuciprian
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MU4RJNNF74QKY
4
- Tags: regenerate, thumbnails, advanced, easy, day, weeek, month
5
- Requires at least: 3.1
6
- Tested up to: 4.4.1
7
- Stable tag: 1.1.2
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- Description: A plugin that makes regenerating thumbnails even easier than before and more flexible.
12
-
13
- == Description ==
14
-
15
- A plugin that makes regenerating thumbnails even easier than before and more flexible.
16
- If you install a new theme, it might have different image sizes it wants to use. those image sizes are cropped and resized into thumbnails only when you upload new images. So what happens with your old images?
17
- the ones you already uploaded? They need to be regenerated, this is what this plugin does. It takes each image and generates the thumbnails for each and every one of them.
18
-
19
-
20
- Features:
21
-
22
- * You can select a period in time for the images to be regenerated from
23
- * The period is last day, last week, last month or all
24
- * Clean simple interface where you have a progress bar showing you the percentage of images regenerated
25
- * You get to see the total number of images affected by your period, as well as the images afected so far when processing
26
- * Regenerate thubnails on the fly
27
-
28
- == Installation ==
29
-
30
- This section describes how to install the plugin and get it working.
31
-
32
- e.g.
33
-
34
- 1. Upload regenerate-thumbnails-advanced directory to the `/wp-content/plugins/` directory
35
- 1. Activate the plugin through the 'Plugins' menu in WordPress
36
-
37
- == Frequently Asked Questions ==
38
-
39
- = Can I regenerate just a few images =
40
-
41
- You have the option to select from: all, past day, past week, past month
42
-
43
- = What happens if I close the page and the script is loading? =
44
-
45
- The script stops, it does not run in the background
46
-
47
- == Screenshots ==
48
-
49
- 1. The plugin page where it all happens
50
-
51
-
52
- == Changelog ==
53
-
54
- = 0.7 =
55
- * The first upload of the plugin
56
-
57
- = 0.8 =
58
- *Shows errors
59
- *GD library error missing library present
60
- *added jquery ui images for
61
- *added jquery ui min css file
62
- *removed the incrementation of processed images if there are none (it was showing one was being processed when it wasn't)
63
-
64
- = 0.8.1 =
65
- *images did not get added in the previous version. Neither did the css file for jquery ui
66
-
67
- = 0.8.2 =
68
- *log section showing what's been processed (image name)
69
-
70
- = 0.8.2.1 =
71
- *Images processed gets updated on regenerate request (it was frozen before if no images where available to be processed)
72
- *Added a extra image
73
-
74
- = 0.8.2.2 =
75
- *Added a "no js or js error" message to the page if it's the case
76
-
77
- = 0.8.2.3 =
78
- *Progress and errors aligned with containers
79
- *javascript changed so that it shows processing for errors when processing starts
80
-
81
- = 0.8.2.4 =
82
- *Added time (in seconds) to each processed image - You can see how long each image took
83
- *Error log status changes at the end from Processing to "No errors" if there are no errors.
84
-
85
- = 0.8.2.5 =
86
- *Added Settings link in plugins info page
87
- *Renamed submenu page to Regenerate Thumbnails under Settings
88
-
89
- = 0.8.2.6 =
90
- *Added the possibility to choose a start and end date from where to regenerate the thumbnails from
91
- * Added new style
92
- * Added datepickers
93
-
94
- = 1.0 =
95
- *Regenerate on the fly
96
-
97
- = 1.0.1 =
98
- Removed unnecesary functionality. Just the checkbox for OTF is now available.
99
-
100
- = 1.0.2 =
101
- Fixes a critical bug from the previous version
102
-
103
- = 1.0.3 =
104
- Added donate button
105
-
106
- = 1.1 =
107
- Added Admin builder plugin dependency and functionality.
108
-
109
-
110
- == Upgrade Notice ==
111
-
112
- = 0.7 =
113
- No issues have been detected since this is the first version that's out there. Please report any issues
114
-
115
- = 0.8 =
116
- No issuse with this version that require attention
117
-
118
- = 0.8.1 =
119
- This is a very minor change . Practically fixing the previous change incomplete commit
120
-
121
- = 0.8.2 =
122
- No issuse with this version that require attention
123
-
124
- = 0.8.2.1 =
125
- No issuse with this version that require attention. Small update change
126
-
127
- = 0.8.2.2 =
128
- No issuse with this version that require attention. Small update change. It's basically a feature, so unless you want it, the older version works great.
129
-
130
- = 0.8.2.3 =
131
- No issuse with this version that require attention. Small update change. It's basically a feature, so unless you want it, the older version works great.
132
-
133
- = 0.8.2.4 =
134
- No issuse with this version that require attention. Small update change. It's basically a feature, so unless you want it, the older version works great.
135
-
136
- = 0.8.2.5 =
137
- No issuse with this version that require attention. Small update change. It's basically a feature, so unless you want it, the older version works great.
138
-
139
- = 0.8.2.6 =
140
- This version changes the style and adds a bit of functionality to the general settings (a date start-end option to choose from)
141
-
142
- = 1.0 =
143
- This version changes the style and adds a bit of functionality to the general settings (a date start-end option to choose from)
144
-
145
- = 1.0.1 =
146
- nothing that affect the previous data is changed. Update is save
147
-
148
- = 1.0.2 =
149
- nothing that affect the previous data is changed. Update is save
150
-
151
- = 1.0.3 =
152
- nothing that affect the previous data is changed. Update is save
153
-
154
- = 1.1 =
155
- Database field is saved someplace else now. It needs to be configured again. Basically just go into settings, click to activate and click save.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/regenerate-thumbnails-advanced.php DELETED
@@ -1,178 +0,0 @@
1
- <?php
2
- /*
3
- Plugin Name: reGenerate Thumbnails - advanced
4
- Plugin URI: http://turcuciprian.com
5
- Description: A plugin that makes regenerating thumbnails even easier than before and more flexible.
6
- Version: 1.1.2
7
- Author: turcuciprian
8
- Author URI: http://turcuciprian.com
9
- License: GPLv2 or later
10
- Text Domain: RTA
11
- */
12
- include('abExport.php');
13
-
14
- add_action('admin_enqueue_scripts', 'enqueue_admin');
15
-
16
- function enqueue_admin($hook)
17
- {
18
- if (isset($_GET['page']) && isset($hook)) {
19
- if ($_GET['page'] !== 'regenerate_thumbnails_advanced' && $hook != 'options-general.php ') {
20
- return;
21
- }
22
- }
23
- wp_enqueue_style('rta', plugin_dir_url(__FILE__).'style.css');
24
- }
25
-
26
- /* var @cc cc */
27
-
28
- add_action('init', 'rtaInit');
29
- function rtaInit()
30
- {
31
- global $abGen;
32
- if (!function_exists($abGen,'getField')) {
33
- return true;
34
- }
35
- $rotf = $abGen->getField('abOption_cPage_regenerateThumbnailsAdvanced', 'tab1', 'rtaOTF');
36
- if (!function_exists('gambit_otf_regen_thumbs_media_downsize') && $rotf == 'on') {
37
- add_filter('image_downsize', 'gambit_otf_regen_thumbs_media_downsize', 10, 3);
38
-
39
- /**
40
- * The downsizer. This only does something if the existing image size doesn't exist yet.
41
- *
42
- * @param $out boolean false
43
- * @param $id int Attachment ID
44
- * @param $size mixed The size name, or an array containing the width & height
45
- *
46
- * @return mixed False if the custom downsize failed, or an array of the image if successful
47
- */
48
- function gambit_otf_regen_thumbs_media_downsize($out, $id, $size)
49
- {
50
-
51
- // Gather all the different image sizes of WP (thumbnail, medium, large) and,
52
- // all the theme/plugin-introduced sizes.
53
- global $_gambit_otf_regen_thumbs_all_image_sizes;
54
- if (!isset($_gambit_otf_regen_thumbs_all_image_sizes)) {
55
- global $_wp_additional_image_sizes;
56
-
57
- $_gambit_otf_regen_thumbs_all_image_sizes = array();
58
- $interimSizes = get_intermediate_image_sizes();
59
-
60
- foreach ($interimSizes as $sizeName) {
61
- if (in_array($sizeName, array('thumbnail', 'medium', 'large'))) {
62
- $_gambit_otf_regen_thumbs_all_image_sizes[ $sizeName ]['width'] = get_option($sizeName.'_size_w');
63
- $_gambit_otf_regen_thumbs_all_image_sizes[ $sizeName ]['height'] = get_option($sizeName.'_size_h');
64
- $_gambit_otf_regen_thumbs_all_image_sizes[ $sizeName ]['crop'] = (bool) get_option($sizeName.'_crop');
65
- } elseif (isset($_wp_additional_image_sizes[ $sizeName ])) {
66
- $_gambit_otf_regen_thumbs_all_image_sizes[ $sizeName ] = $_wp_additional_image_sizes[ $sizeName ];
67
- }
68
- }
69
- }
70
-
71
- // This now contains all the data that we have for all the image sizes
72
- $allSizes = $_gambit_otf_regen_thumbs_all_image_sizes;
73
-
74
- // If image size exists let WP serve it like normally
75
- $imagedata = wp_get_attachment_metadata($id);
76
-
77
- // Image attachment doesn't exist
78
- if (!is_array($imagedata)) {
79
- return false;
80
- }
81
-
82
- // If the size given is a string / a name of a size
83
- if (is_string($size)) {
84
-
85
- // If WP doesn't know about the image size name, then we can't really do any resizing of our own
86
- if (empty($allSizes[ $size ])) {
87
- return false;
88
- }
89
-
90
- // If the size has already been previously created, use it
91
- if (!empty($imagedata['sizes'][ $size ]) && !empty($allSizes[ $size ])) {
92
-
93
- // But only if the size remained the same
94
- if ($allSizes[ $size ]['width'] == $imagedata['sizes'][ $size ]['width']
95
- && $allSizes[ $size ]['height'] == $imagedata['sizes'][ $size ]['height']) {
96
- return false;
97
- }
98
-
99
- // Or if the size is different and we found out before that the size really was different
100
- if (!empty($imagedata['sizes'][ $size ][ 'width_query' ])
101
- && !empty($imagedata['sizes'][ $size ]['height_query'])) {
102
- if ($imagedata['sizes'][ $size ]['width_query'] == $allSizes[ $size ]['width']
103
- && $imagedata['sizes'][ $size ]['height_query'] == $allSizes[ $size ]['height']) {
104
- return false;
105
- }
106
- }
107
- }
108
-
109
- // Resize the image
110
- $resized = image_make_intermediate_size(
111
- get_attached_file($id),
112
- $allSizes[ $size ]['width'],
113
- $allSizes[ $size ]['height'],
114
- $allSizes[ $size ]['crop']
115
- );
116
-
117
- // Resize somehow failed
118
- if (!$resized) {
119
- return false;
120
- }
121
-
122
- // Save the new size in WP
123
- $imagedata['sizes'][ $size ] = $resized;
124
-
125
- // Save some additional info so that we'll know next time whether we've resized this before
126
- $imagedata['sizes'][ $size ]['width_query'] = $allSizes[ $size ]['width'];
127
- $imagedata['sizes'][ $size ]['height_query'] = $allSizes[ $size ]['height'];
128
-
129
- wp_update_attachment_metadata($id, $imagedata);
130
-
131
- // Serve the resized image
132
- $att_url = wp_get_attachment_url($id);
133
-
134
- return array(dirname($att_url).'/'.$resized['file'], $resized['width'], $resized['height'], true);
135
-
136
- // If the size given is a custom array size
137
- } elseif (is_array($size)) {
138
- $imagePath = get_attached_file($id);
139
-
140
- // This would be the path of our resized image if the dimensions existed
141
- $imageExt = pathinfo($imagePath, PATHINFO_EXTENSION);
142
- $imagePath = preg_replace('/^(.*)\.'.$imageExt.'$/', sprintf('$1-%sx%s.%s', $size[0], $size[1], $imageExt), $imagePath);
143
-
144
- $att_url = wp_get_attachment_url($id);
145
-
146
- // If it already exists, serve it
147
- if (file_exists($imagePath)) {
148
- return array(dirname($att_url).'/'.basename($imagePath), $size[0], $size[1], true);
149
- }
150
-
151
- // If not, resize the image...
152
- $resized = image_make_intermediate_size(
153
- get_attached_file($id),
154
- $size[0],
155
- $size[1],
156
- true
157
- );
158
-
159
- // Get attachment meta so we can add new size
160
- $imagedata = wp_get_attachment_metadata($id);
161
-
162
- // Save the new size in WP so that it can also perform actions on it
163
- $imagedata['sizes'][ $size[0].'x'.$size[1] ] = $resized;
164
- wp_update_attachment_metadata($id, $imagedata);
165
-
166
- // Resize somehow failed
167
- if (!$resized) {
168
- return false;
169
- }
170
-
171
- // Then serve it
172
- return array(dirname($att_url).'/'.$resized['file'], $resized['width'], $resized['height'], true);
173
- }
174
-
175
- return false;
176
- }
177
- }
178
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/screenshot-1.png DELETED
Binary file
trunk/style.css DELETED
@@ -1,59 +0,0 @@
1
- /*Progress bar style*/
2
- #rta .ui-progressbar{
3
- position:relative;
4
- }
5
- #rta .ui-progressbar .ui-progressbar-value.ui-widget-header{
6
- background-color: #34e749;
7
- position:relative;
8
- }
9
- #rta .ui-progressbar .progress-label {
10
- position: absolute;
11
- left: 50%;
12
- top: 4px;
13
- font-weight: bold;
14
- text-shadow: 1px 1px 0 #fff;
15
- z-index: 10;
16
- }
17
- /*information section*/
18
- #rta .info{
19
- padding:20px 0;
20
- line-height: 24px;
21
- }
22
- #rta .info span{
23
- font-weight: bold;
24
- font-size: 18px;
25
- }
26
- /*Errors style*/
27
- #rta .errors,
28
- #rta .logstatus{
29
- float:left;
30
- width:96%;
31
- padding:10px;
32
- margin:0px 1% 0 0;
33
- text-align: left;
34
- }
35
- #rta .errors div{
36
- margin:10px;
37
- padding:5px 0 5px 10px;
38
- }
39
- #rta .errors div b{
40
- font-size: 16px;
41
- }
42
- #rta .errors div.ui-state-error{
43
- background:#cd0a0a;
44
- }
45
- #rta .hidden{
46
- display:none;
47
- }
48
- #rta #no-js h1{
49
- color:red;
50
- text-align: center;
51
- margin:140px 0 100px 0;
52
- }#rta .wrap{
53
- float:left;
54
- width:46%;
55
- }
56
- #rta .otf{
57
- display: inline-block;
58
- margin:20px 0 0 0;
59
- }