OTF Regenerate Thumbnails - Version 0.2

Version Description

  • Bug fix: image size names which do not exist
Download this release

Release Info

Developer bfintal
Plugin Icon 128x128 OTF Regenerate Thumbnails
Version 0.2
Comparing to
See all releases

Code changes from version 0.1 to 0.2

Files changed (2) hide show
  1. otf_regen_thumbs.php +7 -2
  2. readme.txt +25 -4
otf_regen_thumbs.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: OTF Regenerate Thumbnails
4
  Plugin URI: http://github.com
5
  Description: Automatically regenerates your thumbnails on the fly (OTF) after changing the thumbnail sizes or switching themes.
6
  Author: Benjamin Intal - Gambit Technologies Inc
7
- Version: 0.1
8
  Author URI: http://gambit.ph
9
  */
10
 
@@ -67,9 +67,14 @@ if ( ! function_exists( 'gambit_otf_regen_thumbs_media_downsize' ) ) {
67
 
68
  // If the size given is a string / a name of a size
69
  if ( is_string( $size ) ) {
 
 
 
 
 
70
 
71
  // If the size has already been previously created, use it
72
- if ( isset( $imagedata['sizes'][ $size ] ) && ! empty( $allSizes[ $size ] ) ) {
73
 
74
  // But only if the size remained the same
75
  if ( $allSizes[ $size ]['width'] == $imagedata['sizes'][ $size ]['width']
4
  Plugin URI: http://github.com
5
  Description: Automatically regenerates your thumbnails on the fly (OTF) after changing the thumbnail sizes or switching themes.
6
  Author: Benjamin Intal - Gambit Technologies Inc
7
+ Version: 0.2
8
  Author URI: http://gambit.ph
9
  */
10
 
67
 
68
  // If the size given is a string / a name of a size
69
  if ( is_string( $size ) ) {
70
+
71
+ // If WP doesn't know about the image size name, then we can't really do any resizing of our own
72
+ if ( empty( $allSizes[ $size ] ) ) {
73
+ return false;
74
+ }
75
 
76
  // If the size has already been previously created, use it
77
+ if ( ! empty( $imagedata['sizes'][ $size ] ) && ! empty( $allSizes[ $size ] ) ) {
78
 
79
  // But only if the size remained the same
80
  if ( $allSizes[ $size ]['width'] == $imagedata['sizes'][ $size ]['width']
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Plugin Name ===
2
  Contributors: bfintal
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=D2MK28E7BDLHC
4
  Tags: thumbnail, thumbnails, resize, regenerate, automatic, featured image, feature image, on the fly, otf
5
  Requires at least: 3.8
6
  Tested up to: 4.1
7
- Stable tag: 0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -15,6 +15,7 @@ Automatically regenerates your thumbnails on the fly when thumbnail sizes change
15
  This plugin behaves similarly to [Regenerate Thumbnails](https://wordpress.org/plugins/regenerate-thumbnails/) except that images are resized automatically / on the fly, when they are used. Once created, they won't be processed again.
16
 
17
  Your thumbnails will now resize when:
 
18
  * Image Sizes in **Settings > Media** is modified,
19
  * Switching themes & plugins with different thumbnail / featured image sizes
20
 
@@ -34,6 +35,21 @@ Go back to your gallery that you previously created and refresh your browser. Mo
34
 
35
  OTF Regenerate Thumbnails fixes this for you.
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  = Features =
38
 
39
  * Creates Resizes thumbnails on the fly
@@ -67,5 +83,10 @@ OTF Regenerate Thumbnails fixes this for you.
67
 
68
  == Changelog ==
69
 
70
- = 1.0 =
71
- First release
 
 
 
 
 
1
+ === OTF Regenerate Thumbnails ===
2
  Contributors: bfintal
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=D2MK28E7BDLHC
4
  Tags: thumbnail, thumbnails, resize, regenerate, automatic, featured image, feature image, on the fly, otf
5
  Requires at least: 3.8
6
  Tested up to: 4.1
7
+ Stable tag: 0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
15
  This plugin behaves similarly to [Regenerate Thumbnails](https://wordpress.org/plugins/regenerate-thumbnails/) except that images are resized automatically / on the fly, when they are used. Once created, they won't be processed again.
16
 
17
  Your thumbnails will now resize when:
18
+
19
  * Image Sizes in **Settings > Media** is modified,
20
  * Switching themes & plugins with different thumbnail / featured image sizes
21
 
35
 
36
  OTF Regenerate Thumbnails fixes this for you.
37
 
38
+ = Usage =
39
+
40
+ OTF Regenerate Thumbnails should work right away, and your images should get resized when the dimensions get changed.
41
+
42
+ **For developers & tinkerers, ensuring your images get resized properly requires you to use WordPress' image functions to display featured images and image attachments.** Don't worry, this is a good thing.
43
+
44
+ Make sure you use these WordPress functions **every time you display images**:
45
+
46
+ * [`wp_get_attachment_image_src`](http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src)
47
+ * [`wp_get_attachment_image`](http://codex.wordpress.org/Function_Reference/wp_get_attachment_image)
48
+ * [`the_post_thumbnail`](http://codex.wordpress.org/Function_Reference/the_post_thumbnail)
49
+ * [`get_the_post_thumbnail`](http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail)
50
+
51
+ You can also add size *names* using [`add_image_size`](http://codex.wordpress.org/Function_Reference/add_image_size)
52
+
53
  = Features =
54
 
55
  * Creates Resizes thumbnails on the fly
83
 
84
  == Changelog ==
85
 
86
+ = 0.2 =
87
+
88
+ * Bug fix: image size names which do not exist
89
+
90
+ = 0.1 =
91
+
92
+ * First release