Smush Image Compression and Optimization - Version 1.6.0

Version Description

  • added setting to disable automatic smushing on upload (default is true)
  • on HTTP error, smushing will be temporarily disabled for 6 hours
Download this release

Release Info

Developer alexdunae
Plugin Icon 128x128 Smush Image Compression and Optimization
Version 1.6.0
Comparing to
See all releases

Code changes from version 1.6.2 to 1.6.0

Files changed (3) hide show
  1. readme.txt +15 -18
  2. settings.php +14 -10
  3. wp-smushit.php +5 -11
readme.txt CHANGED
@@ -1,20 +1,19 @@
1
  === WP Smush.it ===
2
  Plugin Name: WP Smush.it
3
- Version: 1.6.2
4
  Author: Dialect
5
  Author URI: http://dialect.ca/?wp_smush_it
6
- Contributors: alexdunae, WPMUDEV
7
  Tags: images, image, attachments, attachment
8
  Requires at least: 2.9
9
  Tested up to: 3.3.2
10
- Stable tag: 1.6.2
 
11
 
12
  Reduce image file sizes and improve performance using the <a href="http://smush.it/">Smush.it</a> API within WordPress.
13
 
14
  == Description ==
15
 
16
- = Dear Smushers: WP Smush.it has found a new maintainer. Stay tuned for a fresh release. =
17
-
18
  Yahoo's excellent <a href="http://developer.yahoo.com/performance/">Exceptional Performance series</a> recommends <a href="http://developer.yahoo.com/performance/rules.html#opt_images">optimizing images</a> in several lossless ways:
19
 
20
  * stripping meta data from JPEGs
@@ -32,16 +31,26 @@ You can also run your existing images through Smush.it via the WordPress `Media
32
 
33
  As of version 1.4.0 there is a new, experimental `Bulk Smush.it` feature. You can find the link under the `Media Library` tab.
34
 
35
- = Errors =
36
 
37
  Sometimes the Smush.it service goes down or is under heavy load. If the plugin has difficulty connecting to Smush.it then automatically smushing is temporarily disabled (currently for 6 hours). You can always re-enable it via the `Media > Settings` screen or manually smush the image from the Media Library.
38
 
 
 
39
  = NextGEN Gallery =
40
  NextGEN user? Also download the <a href="http://wordpress.org/extend/plugins/wp-smushit-nextgen-gallery-integration/">WP Smush.it NextGEN Integration</a> plugin.
41
 
42
  = Privacy =
43
  Be sure you&rsquo;re comfortable with Smush.it&rsquo;s privacy policy (found on their <a href="http://info.yahoo.com/legal/us/yahoo/smush_it/smush_it-4378.html">FAQ</a>).
44
 
 
 
 
 
 
 
 
 
45
  == Screenshots ==
46
 
47
  1. See the savings from Smush.it in the Media Library.
@@ -53,20 +62,8 @@ Be sure you&rsquo;re comfortable with Smush.it&rsquo;s privacy policy (found on
53
  1. Automatic smushing of uploaded images can be controlled on the `Settings > Media` screen
54
  1. Done!
55
 
56
- == Upgrade Notice ==
57
-
58
- = 1.6.2 =
59
-
60
- Dear Smushers: WP Smush.it has found a new maintainer. Stay tuned for a fresh release.
61
-
62
  == Changelog ==
63
 
64
- = 1.6.2 =
65
- * about to get a new lease on life notice
66
-
67
- = 1.6.1 =
68
- * no longer maintained notice
69
-
70
  = 1.6.0 =
71
  * added setting to disable automatic smushing on upload (default is true)
72
  * on HTTP error, smushing will be temporarily disabled for 6 hours
1
  === WP Smush.it ===
2
  Plugin Name: WP Smush.it
3
+ Version: 1.6.0
4
  Author: Dialect
5
  Author URI: http://dialect.ca/?wp_smush_it
6
+ Contributors: alexdunae
7
  Tags: images, image, attachments, attachment
8
  Requires at least: 2.9
9
  Tested up to: 3.3.2
10
+ Stable tag: 1.6.0
11
+ Donate link: http://dunae.ca/donate.html
12
 
13
  Reduce image file sizes and improve performance using the <a href="http://smush.it/">Smush.it</a> API within WordPress.
14
 
15
  == Description ==
16
 
 
 
17
  Yahoo's excellent <a href="http://developer.yahoo.com/performance/">Exceptional Performance series</a> recommends <a href="http://developer.yahoo.com/performance/rules.html#opt_images">optimizing images</a> in several lossless ways:
18
 
19
  * stripping meta data from JPEGs
31
 
32
  As of version 1.4.0 there is a new, experimental `Bulk Smush.it` feature. You can find the link under the `Media Library` tab.
33
 
34
+ = Errors
35
 
36
  Sometimes the Smush.it service goes down or is under heavy load. If the plugin has difficulty connecting to Smush.it then automatically smushing is temporarily disabled (currently for 6 hours). You can always re-enable it via the `Media > Settings` screen or manually smush the image from the Media Library.
37
 
38
+ You can also define how long you want to wait for the Smush.it server to respond.
39
+
40
  = NextGEN Gallery =
41
  NextGEN user? Also download the <a href="http://wordpress.org/extend/plugins/wp-smushit-nextgen-gallery-integration/">WP Smush.it NextGEN Integration</a> plugin.
42
 
43
  = Privacy =
44
  Be sure you&rsquo;re comfortable with Smush.it&rsquo;s privacy policy (found on their <a href="http://info.yahoo.com/legal/us/yahoo/smush_it/smush_it-4378.html">FAQ</a>).
45
 
46
+ = Donate? =
47
+
48
+ If you're so inclined, I've setup <a href="http://dunae.ca/donate.html">a donation page</a>.
49
+
50
+ = Updates, etc... =
51
+
52
+ Plugin updates are announced on [http://www.twitter.com/TheCHANGELOG](http://www.twitter.com/TheCHANGELOG).
53
+
54
  == Screenshots ==
55
 
56
  1. See the savings from Smush.it in the Media Library.
62
  1. Automatic smushing of uploaded images can be controlled on the `Settings > Media` screen
63
  1. Done!
64
 
 
 
 
 
 
 
65
  == Changelog ==
66
 
 
 
 
 
 
 
67
  = 1.6.0 =
68
  * added setting to disable automatic smushing on upload (default is true)
69
  * on HTTP error, smushing will be temporarily disabled for 6 hours
settings.php CHANGED
@@ -1,23 +1,24 @@
1
  <?php
2
 
3
  /*
4
-
5
  Each service has a setting specifying whether it should be used automatically on upload.
6
-
7
  Values are:
8
  -1 Don't use (until manually enabled via Media > Settings)
9
  0 Use automatically
10
  n Any other number is a Unix timestamp indicating when the service can be used again
11
-
12
  */
13
-
14
  define('WP_SMUSHIT_AUTO_OK', 0);
15
  define('WP_SMUSHIT_AUTO_NEVER', -1);
16
 
17
 
18
  function wp_smushit_register_settings() {
19
  add_settings_section( 'wp_smushit_settings', 'WP Smush.it', 'wp_smushit_settings_cb', 'media' );
20
- add_settings_field( 'wp_smushit_smushit_auto', 'Use Smush.it on upload?', 'wp_smushit_smushit_auto_cb', 'media', 'wp_smushit_settings' );
 
21
  register_setting( 'media', 'wp_smushit_smushit_auto');
22
  }
23
  add_action('admin_init', 'wp_smushit_register_settings');
@@ -25,11 +26,8 @@
25
  function wp_smushit_settings_cb() {
26
  }
27
 
28
- function wp_smushit_smushit_auto_cb() {
29
- wp_smushit_render_auto_opts( 'wp_smushit_smushit_auto' );
30
- }
31
-
32
- function wp_smushit_render_auto_opts( $key ) {
33
  $val = intval( get_option( $key, WP_SMUSHIT_AUTO_OK ) );
34
  printf( "<select name='%1\$s' id='%1\$s'>", esc_attr( $key ) );
35
  echo '<option value=' . WP_SMUSHIT_AUTO_OK . ' ' . selected( WP_SMUSHIT_AUTO_OK, $val ) . '>Automatically process on upload</option>';
@@ -41,6 +39,12 @@
41
  echo '</select>';
42
  }
43
 
 
 
 
 
 
 
44
  // default is 6hrs
45
  function wp_smushit_temporarily_disable( $seconds = 21600) {
46
  update_option( 'wp_smushit_smushit_auto', time() + $seconds );
1
  <?php
2
 
3
  /*
4
+
5
  Each service has a setting specifying whether it should be used automatically on upload.
6
+
7
  Values are:
8
  -1 Don't use (until manually enabled via Media > Settings)
9
  0 Use automatically
10
  n Any other number is a Unix timestamp indicating when the service can be used again
11
+
12
  */
13
+
14
  define('WP_SMUSHIT_AUTO_OK', 0);
15
  define('WP_SMUSHIT_AUTO_NEVER', -1);
16
 
17
 
18
  function wp_smushit_register_settings() {
19
  add_settings_section( 'wp_smushit_settings', 'WP Smush.it', 'wp_smushit_settings_cb', 'media' );
20
+ add_settings_field( 'wp_smushit_smushit_auto', 'Use Smush.it on upload?', 'wp_smushit_render_auto_opts', 'media', 'wp_smushit_settings' );
21
+ add_settings_field( 'wp_smushit_smushit_timeout', 'How many seconds should we wait for a response from Smush.it?', 'wp_smushit_render_timeout_opts', 'media', 'wp_smushit_settings' );
22
  register_setting( 'media', 'wp_smushit_smushit_auto');
23
  }
24
  add_action('admin_init', 'wp_smushit_register_settings');
26
  function wp_smushit_settings_cb() {
27
  }
28
 
29
+ function wp_smushit_render_auto_opts() {
30
+ $key = 'wp_smushit_smushit_auto';
 
 
 
31
  $val = intval( get_option( $key, WP_SMUSHIT_AUTO_OK ) );
32
  printf( "<select name='%1\$s' id='%1\$s'>", esc_attr( $key ) );
33
  echo '<option value=' . WP_SMUSHIT_AUTO_OK . ' ' . selected( WP_SMUSHIT_AUTO_OK, $val ) . '>Automatically process on upload</option>';
39
  echo '</select>';
40
  }
41
 
42
+ function wp_smushit_render_timeout_opts( $key ) {
43
+ $key = 'wp_smushit_smushit_timeout';
44
+ $val = intval( get_option( $key, WP_SMUSHIT_AUTO_OK ) );
45
+ printf( "<input type='text' name='%1\$s' id='%1\$s'>", esc_attr( $key ), intval( get_option( $key, 60 ) ) );
46
+ }
47
+
48
  // default is 6hrs
49
  function wp_smushit_temporarily_disable( $seconds = 21600) {
50
  update_option( 'wp_smushit_smushit_auto', time() + $seconds );
wp-smushit.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Smush.it
4
  Plugin URI: http://dialect.ca/code/wp-smushit/
5
  Description: Reduce image file sizes and improve performance using the <a href="http://smush.it/">Smush.it</a> API within WordPress.
6
  Author: Dialect
7
- Version: 1.6.2
8
  Author URI: http://dialect.ca/
9
  */
10
 
@@ -239,10 +239,6 @@ function wp_smushit_should_resmush($previous_status) {
239
  * Called after `wp_generate_attachment_metadata` is completed.
240
  */
241
  function wp_smushit_resize_from_meta_data($meta, $ID = null, $force_resmush = true) {
242
- if ( $ID && wp_attachment_is_image( $ID ) === false ) {
243
- return $meta;
244
- }
245
-
246
  $file_path = $meta['file'];
247
  $store_absolute_path = true;
248
  $upload_dir = wp_upload_dir();
@@ -347,12 +343,10 @@ function wp_smushit_custom_column($column_name, $id) {
347
  $id,
348
  __('Re-smush', WP_SMUSHIT_DOMAIN));
349
  } else {
350
- if ( wp_attachment_is_image( $id ) ) {
351
- print __('Not processed', WP_SMUSHIT_DOMAIN);
352
- printf("<br><a href=\"admin.php?action=wp_smushit_manual&amp;attachment_ID=%d\">%s</a>",
353
- $id,
354
- __('Smush.it now!', WP_SMUSHIT_DOMAIN));
355
- }
356
  }
357
  }
358
  }
4
  Plugin URI: http://dialect.ca/code/wp-smushit/
5
  Description: Reduce image file sizes and improve performance using the <a href="http://smush.it/">Smush.it</a> API within WordPress.
6
  Author: Dialect
7
+ Version: 1.6.0
8
  Author URI: http://dialect.ca/
9
  */
10
 
239
  * Called after `wp_generate_attachment_metadata` is completed.
240
  */
241
  function wp_smushit_resize_from_meta_data($meta, $ID = null, $force_resmush = true) {
 
 
 
 
242
  $file_path = $meta['file'];
243
  $store_absolute_path = true;
244
  $upload_dir = wp_upload_dir();
343
  $id,
344
  __('Re-smush', WP_SMUSHIT_DOMAIN));
345
  } else {
346
+ print __('Not processed', WP_SMUSHIT_DOMAIN);
347
+ printf("<br><a href=\"admin.php?action=wp_smushit_manual&amp;attachment_ID=%d\">%s</a>",
348
+ $id,
349
+ __('Smush.it now!', WP_SMUSHIT_DOMAIN));
 
 
350
  }
351
  }
352
  }