ImageMagick Engine - Version 1.3.2-beta1

Version Description

  • Tested with WP 3.3-beta2
  • Use WordPress version of jQuery UI progressbar if available
  • Split plugin init into early and late part
  • Fix PHP notice (in initial plugin configuration)
Download this release

Release Info

Developer orangelab
Plugin Icon 128x128 ImageMagick Engine
Version 1.3.2-beta1
Comparing to
See all releases

Code changes from version 1.3.1 to 1.3.2-beta1

Files changed (2) hide show
  1. imagemagick-engine.php +26 -20
  2. readme.txt +7 -1
imagemagick-engine.php CHANGED
@@ -5,7 +5,7 @@
5
  Description: Improve the quality of re-sized images by replacing standard GD library with ImageMagick
6
  Author: Orangelab
7
  Author URI: http://www.orangelab.se
8
- Version: 1.3.1
9
  Text Domain: imagemagick-engine
10
 
11
  Copyright 2010, 2011 Orangelab
@@ -29,6 +29,7 @@
29
 
30
  /*
31
  * Current todo list:
 
32
  * - test command line version string
33
  * - test php module with required image formats
34
  * - handle errors in resize, fall back to GD
@@ -82,10 +83,11 @@ $ime_image_file = null;
82
  /*
83
  * Functions
84
  */
85
- add_action('plugins_loaded', 'ime_init');
 
86
 
87
- /* Plugin setup */
88
- function ime_init() {
89
  load_plugin_textdomain('imagemagick-engine', false, dirname(plugin_basename(__FILE__)) . '/languages');
90
 
91
  if (ime_active()) {
@@ -93,7 +95,10 @@ function ime_init() {
93
  add_filter('wp_read_image_metadata', 'ime_filter_read_image_metadata', 10, 3);
94
  add_filter('wp_generate_attachment_metadata', 'ime_filter_attachment_metadata', 10, 2);
95
  }
 
96
 
 
 
97
  if (is_admin()) {
98
  add_action('admin_menu', 'ime_admin_menu');
99
  add_filter('plugin_action_links', 'ime_filter_plugin_actions', 10, 2 );
@@ -102,17 +107,20 @@ function ime_init() {
102
  add_action('wp_ajax_ime_test_im_path', 'ime_ajax_test_im_path');
103
  add_action('wp_ajax_ime_process_image', 'ime_ajax_process_image');
104
  add_action('wp_ajax_ime_regeneration_get_images','ime_ajax_regeneration_get_images');
105
-
106
- wp_register_script('ime-admin', plugins_url('/js/ime-admin.js', __FILE__), array('jquery'));
107
 
108
- /*
109
- * jQuery UI version 1.7 and 1.8 seems incompatible...
110
- */
111
- if (ime_script_version_compare('jquery-ui-core', '1.8', '>=')) {
112
- wp_register_script('jquery-ui-progressbar', plugins_url('/js/ui.progressbar-1.8.9.js', __FILE__), array('jquery-ui-core', 'jquery-ui-widget'), '1.8.9');
113
- } else {
114
- wp_register_script('jquery-ui-progressbar', plugins_url('/js/ui.progressbar-1.7.2.js', __FILE__), array('jquery-ui-core'), '1.7.2');
 
 
 
115
  }
 
 
116
  }
117
  }
118
 
@@ -666,19 +674,17 @@ function ime_ajax_process_image() {
666
  function ime_admin_menu() {
667
  $page = add_options_page('ImageMagick Engine', 'ImageMagick Engine', 'manage_options', 'imagemagick-engine', 'ime_option_page');
668
 
669
- add_action('admin_print_scripts-' . $page, 'ime_admin_scripts');
670
- add_action('admin_print_styles-' . $page, 'ime_admin_styles');
671
  }
672
 
673
  /* Enqueue admin page scripts */
674
- function ime_admin_scripts() {
675
  wp_enqueue_script('ime-admin');
676
- wp_enqueue_script('jquery-ui-dialog');
677
- wp_enqueue_script('jquery-ui-progressbar');
678
  }
679
 
680
  /* Enqueue admin page style */
681
- function ime_admin_styles() {
682
  wp_enqueue_style( 'ime-admin-style', plugins_url('/css/ime-admin.css', __FILE__), array());
683
  }
684
 
@@ -794,7 +800,7 @@ function ime_option_page() {
794
  }
795
 
796
  $current_mode = ime_get_option('mode');
797
- if (!$modes_valid[$current_mode])
798
  $current_mode = null;
799
  if (is_null($current_mode) && $any_valid) {
800
  foreach ($modes_valid AS $m => $valid) {
5
  Description: Improve the quality of re-sized images by replacing standard GD library with ImageMagick
6
  Author: Orangelab
7
  Author URI: http://www.orangelab.se
8
+ Version: 1.3.2-beta1
9
  Text Domain: imagemagick-engine
10
 
11
  Copyright 2010, 2011 Orangelab
29
 
30
  /*
31
  * Current todo list:
32
+ * - can we use --strip (or similar) without loosing color profile?
33
  * - test command line version string
34
  * - test php module with required image formats
35
  * - handle errors in resize, fall back to GD
83
  /*
84
  * Functions
85
  */
86
+ add_action('plugins_loaded', 'ime_init_early');
87
+ add_action('init', 'ime_init');
88
 
89
+ /* Plugin setup (early) */
90
+ function ime_init_early() {
91
  load_plugin_textdomain('imagemagick-engine', false, dirname(plugin_basename(__FILE__)) . '/languages');
92
 
93
  if (ime_active()) {
95
  add_filter('wp_read_image_metadata', 'ime_filter_read_image_metadata', 10, 3);
96
  add_filter('wp_generate_attachment_metadata', 'ime_filter_attachment_metadata', 10, 2);
97
  }
98
+ }
99
 
100
+ /* Plugin setup */
101
+ function ime_init() {
102
  if (is_admin()) {
103
  add_action('admin_menu', 'ime_admin_menu');
104
  add_filter('plugin_action_links', 'ime_filter_plugin_actions', 10, 2 );
107
  add_action('wp_ajax_ime_test_im_path', 'ime_ajax_test_im_path');
108
  add_action('wp_ajax_ime_process_image', 'ime_ajax_process_image');
109
  add_action('wp_ajax_ime_regeneration_get_images','ime_ajax_regeneration_get_images');
 
 
110
 
111
+ // Do we have a WP native version of progressbar?
112
+ if (!wp_script_is('jquery-ui-progressbar', 'registered')) {
113
+ /*
114
+ * jQuery UI version 1.7 and 1.8 seems incompatible...
115
+ */
116
+ if (ime_script_version_compare('jquery-ui-core', '1.8', '>=')) {
117
+ wp_register_script('jquery-ui-progressbar', plugins_url('/js/ui.progressbar-1.8.9.js', __FILE__), array('jquery-ui-core', 'jquery-ui-widget'), '1.8.9');
118
+ } else {
119
+ wp_register_script('jquery-ui-progressbar', plugins_url('/js/ui.progressbar-1.7.2.js', __FILE__), array('jquery-ui-core'), '1.7.2');
120
+ }
121
  }
122
+
123
+ wp_register_script('ime-admin', plugins_url('/js/ime-admin.js', __FILE__), array('jquery', 'jquery-ui-dialog', 'jquery-ui-progressbar'));
124
  }
125
  }
126
 
674
  function ime_admin_menu() {
675
  $page = add_options_page('ImageMagick Engine', 'ImageMagick Engine', 'manage_options', 'imagemagick-engine', 'ime_option_page');
676
 
677
+ add_action('admin_print_scripts-' . $page, 'ime_admin_print_scripts');
678
+ add_action('admin_print_styles-' . $page, 'ime_admin_print_styles');
679
  }
680
 
681
  /* Enqueue admin page scripts */
682
+ function ime_admin_print_scripts() {
683
  wp_enqueue_script('ime-admin');
 
 
684
  }
685
 
686
  /* Enqueue admin page style */
687
+ function ime_admin_print_styles() {
688
  wp_enqueue_style( 'ime-admin-style', plugins_url('/css/ime-admin.css', __FILE__), array());
689
  }
690
 
800
  }
801
 
802
  $current_mode = ime_get_option('mode');
803
+ if (!isset($modes_valid[$current_mode]) || !$modes_valid[$current_mode])
804
  $current_mode = null;
805
  if (is_null($current_mode) && $any_valid) {
806
  foreach ($modes_valid AS $m => $valid) {
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: orangelab
3
  Tags: image, images, picture, imagemagick, gd
4
  Requires at least: 2.9
5
- Tested up to: 3.2.1
6
  Stable tag: 1.3.1
7
 
8
  Improve the quality of re-sized images by replacing standard GD library with ImageMagick.
@@ -74,6 +74,12 @@ You'll probably have problems with various other plugins too unless you fix this
74
 
75
  == Changelog ==
76
 
 
 
 
 
 
 
77
  = 1.3.1 =
78
  * Tested with WP 3.2.1
79
  * Bugfix: escape '^' character on Windows (thanks to alx359)
2
  Contributors: orangelab
3
  Tags: image, images, picture, imagemagick, gd
4
  Requires at least: 2.9
5
+ Tested up to: 3.3-beta2
6
  Stable tag: 1.3.1
7
 
8
  Improve the quality of re-sized images by replacing standard GD library with ImageMagick.
74
 
75
  == Changelog ==
76
 
77
+ = 1.3.2-beta1 =
78
+ * Tested with WP 3.3-beta2
79
+ * Use WordPress version of jQuery UI progressbar if available
80
+ * Split plugin init into early and late part
81
+ * Fix PHP notice (in initial plugin configuration)
82
+
83
  = 1.3.1 =
84
  * Tested with WP 3.2.1
85
  * Bugfix: escape '^' character on Windows (thanks to alx359)