Version Description
- Allow to generate WebP images on already optimzed images (bulk optimizer)
Download this release
Release Info
Developer | keycdn |
Plugin | Optimus – WordPress Image Optimizer |
Version | 1.4.2 |
Comparing to | |
See all releases |
Code changes from version 1.4.1 to 1.4.2
- inc/optimus_request.class.php +16 -16
- inc/optimus_settings.class.php +2 -2
- lang/optimus-de_DE.mo +0 -0
- lang/optimus-de_DE.po +11 -19
- optimus.php +1 -1
- readme.txt +4 -1
inc/optimus_request.class.php
CHANGED
@@ -29,7 +29,7 @@ class Optimus_Request
|
|
29 |
* Image optimization post process (ajax)
|
30 |
*
|
31 |
* @since 1.3.8
|
32 |
-
* @change 1.
|
33 |
*
|
34 |
* @return json $metadata Update metadata information
|
35 |
*/
|
@@ -62,21 +62,20 @@ class Optimus_Request
|
|
62 |
exit;
|
63 |
}
|
64 |
|
65 |
-
/* check if already optimized */
|
66 |
-
if (isset($metadata['optimus'])) {
|
67 |
-
$message = __("Already optimized", "optimus");
|
68 |
-
echo json_encode(array('info' => $message));
|
69 |
-
exit;
|
70 |
-
}
|
71 |
-
|
72 |
/* optimize image */
|
73 |
$optimus_metadata = self::optimize_upload_images($metadata, $id);
|
74 |
|
75 |
-
if (!empty($optimus_metadata['optimus']['error'])) {
|
76 |
echo json_encode(array('error' => $optimus_metadata['optimus']['error']));
|
77 |
exit;
|
78 |
}
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
/* update metadata */
|
81 |
update_post_meta($id, '_wp_attachment_metadata', $optimus_metadata);
|
82 |
|
@@ -89,7 +88,7 @@ class Optimus_Request
|
|
89 |
* Build optimization for a upload image including previews
|
90 |
*
|
91 |
* @since 0.0.1
|
92 |
-
* @change 1.
|
93 |
*
|
94 |
* @param array $upload_data Incoming upload information
|
95 |
* @param integer $attachment_id Attachment ID
|
@@ -97,8 +96,11 @@ class Optimus_Request
|
|
97 |
*/
|
98 |
|
99 |
public static function optimize_upload_images($upload_data, $attachment_id) {
|
|
|
|
|
|
|
100 |
/* Already optimized? */
|
101 |
-
if ( ! empty($upload_data['optimus']) ) {
|
102 |
return $upload_data;
|
103 |
}
|
104 |
|
@@ -150,9 +152,6 @@ class Optimus_Request
|
|
150 |
return $upload_data;
|
151 |
}
|
152 |
|
153 |
-
/* Get plugin options */
|
154 |
-
$options = Optimus::get_options();
|
155 |
-
|
156 |
/* Init arrays */
|
157 |
$todo_files = array();
|
158 |
$diff_filesizes = array();
|
@@ -182,7 +181,7 @@ class Optimus_Request
|
|
182 |
/* Search for thumbs */
|
183 |
if ( ! empty($upload_data['sizes']) ) {
|
184 |
foreach( $upload_data['sizes'] as $thumb ) {
|
185 |
-
if ( $thumb['file'] && self::_allowed_mime_type($thumb['mime-type']) ) {
|
186 |
array_push(
|
187 |
$todo_files,
|
188 |
$thumb['file']
|
@@ -270,7 +269,8 @@ class Optimus_Request
|
|
270 |
if ( $received ) {
|
271 |
$upload_data['optimus'] = array(
|
272 |
'profit' => max($diff_filesizes),
|
273 |
-
'quantity' => round( $received * 100 / $ordered )
|
|
|
274 |
);
|
275 |
}
|
276 |
|
29 |
* Image optimization post process (ajax)
|
30 |
*
|
31 |
* @since 1.3.8
|
32 |
+
* @change 1.4.2
|
33 |
*
|
34 |
* @return json $metadata Update metadata information
|
35 |
*/
|
62 |
exit;
|
63 |
}
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
/* optimize image */
|
66 |
$optimus_metadata = self::optimize_upload_images($metadata, $id);
|
67 |
|
68 |
+
if ( !empty($optimus_metadata['optimus']['error']) ) {
|
69 |
echo json_encode(array('error' => $optimus_metadata['optimus']['error']));
|
70 |
exit;
|
71 |
}
|
72 |
|
73 |
+
/* check if optimus array empty */
|
74 |
+
if ( empty($optimus_metadata['optimus']) ) {
|
75 |
+
echo json_encode(array('error' => __("Internal error", "optimus")));
|
76 |
+
exit;
|
77 |
+
}
|
78 |
+
|
79 |
/* update metadata */
|
80 |
update_post_meta($id, '_wp_attachment_metadata', $optimus_metadata);
|
81 |
|
88 |
* Build optimization for a upload image including previews
|
89 |
*
|
90 |
* @since 0.0.1
|
91 |
+
* @change 1.4.2
|
92 |
*
|
93 |
* @param array $upload_data Incoming upload information
|
94 |
* @param integer $attachment_id Attachment ID
|
96 |
*/
|
97 |
|
98 |
public static function optimize_upload_images($upload_data, $attachment_id) {
|
99 |
+
/* Get plugin options */
|
100 |
+
$options = Optimus::get_options();
|
101 |
+
|
102 |
/* Already optimized? */
|
103 |
+
if ( ( ! empty($upload_data['optimus']) && $options['webp_convert'] == 0 ) || ( ! empty($upload_data['optimus']['webp']) && $upload_data['optimus']['webp'] == 1 ) ) {
|
104 |
return $upload_data;
|
105 |
}
|
106 |
|
152 |
return $upload_data;
|
153 |
}
|
154 |
|
|
|
|
|
|
|
155 |
/* Init arrays */
|
156 |
$todo_files = array();
|
157 |
$diff_filesizes = array();
|
181 |
/* Search for thumbs */
|
182 |
if ( ! empty($upload_data['sizes']) ) {
|
183 |
foreach( $upload_data['sizes'] as $thumb ) {
|
184 |
+
if ( $thumb['file'] && ( empty($thumb['mime-type']) || self::_allowed_mime_type($thumb['mime-type']) ) ) {
|
185 |
array_push(
|
186 |
$todo_files,
|
187 |
$thumb['file']
|
269 |
if ( $received ) {
|
270 |
$upload_data['optimus'] = array(
|
271 |
'profit' => max($diff_filesizes),
|
272 |
+
'quantity' => round( $received * 100 / $ordered ),
|
273 |
+
'webp' => $options['webp_convert']
|
274 |
);
|
275 |
}
|
276 |
|
inc/optimus_settings.class.php
CHANGED
@@ -167,12 +167,12 @@ class Optimus_Settings
|
|
167 |
<td>
|
168 |
<fieldset>
|
169 |
<label for="optimus_webp_convert">
|
170 |
-
<input type="checkbox" name="optimus[webp_convert]" id="optimus_webp_convert" value="1" <?php checked(1, $options['webp_convert']) ?>
|
171 |
<?php _e("Creation of WebP files", "optimus"); ?>
|
172 |
</label>
|
173 |
|
174 |
<p class="description">
|
175 |
-
<?php _e("Only <a href=\"https://optimus.io\" target=\"_blank\">Optimus HQ</a>.
|
176 |
</p>
|
177 |
</fieldset>
|
178 |
</td>
|
167 |
<td>
|
168 |
<fieldset>
|
169 |
<label for="optimus_webp_convert">
|
170 |
+
<input type="checkbox" name="optimus[webp_convert]" id="optimus_webp_convert" value="1" <?php checked(1, $options['webp_convert']) ?> />
|
171 |
<?php _e("Creation of WebP files", "optimus"); ?>
|
172 |
</label>
|
173 |
|
174 |
<p class="description">
|
175 |
+
<?php _e("Only <a href=\"https://optimus.io\" target=\"_blank\">Optimus HQ</a>. It is recommended to use the <a href=\"https://wordpress.org/plugins/cache-enabler/\">Cache Enabler plugin</a> to integrate the WebP images. [<a href=\"https://optimus.io/support/convert-jpeg-and-png-to-webp-image-format/\" target=\"_blank\">Details</a>]", "optimus"); ?>
|
176 |
</p>
|
177 |
</fieldset>
|
178 |
</td>
|
lang/optimus-de_DE.mo
CHANGED
Binary file
|
lang/optimus-de_DE.po
CHANGED
@@ -3,7 +3,7 @@ msgstr ""
|
|
3 |
"Project-Id-Version: Optimus\n"
|
4 |
"Report-Msgid-Bugs-To: KeyCDN\n"
|
5 |
"POT-Creation-Date: 2015-06-16 19:46+0100\n"
|
6 |
-
"PO-Revision-Date: 2015-
|
7 |
"Last-Translator: KeyCDN <optimus@keycdn.com>\n"
|
8 |
"Language-Team: KeyCDN\n"
|
9 |
"Language: de_DE\n"
|
@@ -147,31 +147,23 @@ msgstr ""
|
|
147 |
msgid "WebP files"
|
148 |
msgstr "WebP-Dateien"
|
149 |
|
150 |
-
#: inc/optimus_settings.class.php:xx
|
151 |
-
msgid ""
|
152 |
-
"Only for experienced users. Modification of your web server configuration "
|
153 |
-
"required.\\n\\nActivate option?"
|
154 |
-
msgstr ""
|
155 |
-
"Nur für erfahrene Nutzer, da Anpassung der Server-Konfigurationsdatei und "
|
156 |
-
"Qualitätskontrolle notwendig.\\n\\nOption aktivieren?"
|
157 |
-
|
158 |
#: inc/optimus_settings.class.php:xx
|
159 |
msgid "Creation of WebP files"
|
160 |
msgstr "Anfertigung der WebP-Dateien"
|
161 |
|
162 |
#: inc/optimus_settings.class.php:xx
|
163 |
msgid ""
|
164 |
-
"Only <a href=\"https://optimus.io\" target=\"_blank\">Optimus HQ</a>. "
|
165 |
-
"
|
166 |
-
"
|
167 |
-
"support/convert-jpeg-and-png-to-webp-image-format/\" target
|
168 |
-
"\">Details</a>]"
|
169 |
msgstr ""
|
170 |
-
"Nur <a href=\"https://optimus.io\" target=\"_blank\">Optimus HQ</a>. "
|
171 |
-
"
|
172 |
-
"
|
173 |
-
"google.com/114450218898660299759/posts/3emb7o4368X\" target
|
174 |
-
"\">Details</a>]"
|
175 |
|
176 |
#: inc/optimus_settings.class.php:xx
|
177 |
msgid "HTTPS connection"
|
3 |
"Project-Id-Version: Optimus\n"
|
4 |
"Report-Msgid-Bugs-To: KeyCDN\n"
|
5 |
"POT-Creation-Date: 2015-06-16 19:46+0100\n"
|
6 |
+
"PO-Revision-Date: 2015-11-03 15:48+0100\n"
|
7 |
"Last-Translator: KeyCDN <optimus@keycdn.com>\n"
|
8 |
"Language-Team: KeyCDN\n"
|
9 |
"Language: de_DE\n"
|
147 |
msgid "WebP files"
|
148 |
msgstr "WebP-Dateien"
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
#: inc/optimus_settings.class.php:xx
|
151 |
msgid "Creation of WebP files"
|
152 |
msgstr "Anfertigung der WebP-Dateien"
|
153 |
|
154 |
#: inc/optimus_settings.class.php:xx
|
155 |
msgid ""
|
156 |
+
"Only <a href=\"https://optimus.io\" target=\"_blank\">Optimus HQ</a>. It is "
|
157 |
+
"recommended to use the <a href=\"https://wordpress.org/plugins/cache-enabler/"
|
158 |
+
"\">Cache Enabler plugin</a> to integrate the WebP images. [<a href=\"https://"
|
159 |
+
"optimus.io/support/convert-jpeg-and-png-to-webp-image-format/\" target="
|
160 |
+
"\"_blank\">Details</a>]"
|
161 |
msgstr ""
|
162 |
+
"Nur <a href=\"https://optimus.io\" target=\"_blank\">Optimus HQ</a>. Mit dem "
|
163 |
+
"<a href=\"https://wordpress.org/plugins/cache-enabler/\">Cache Enabler "
|
164 |
+
"Plugin</a> können die WebP Bilder einfach integriert werden. [<a href="
|
165 |
+
"\"https://plus.google.com/114450218898660299759/posts/3emb7o4368X\" target="
|
166 |
+
"\"_blank\">Details</a>]"
|
167 |
|
168 |
#: inc/optimus_settings.class.php:xx
|
169 |
msgid "HTTPS connection"
|
optimus.php
CHANGED
@@ -7,7 +7,7 @@ Author: KeyCDN
|
|
7 |
Author URI: https://www.keycdn.com
|
8 |
Plugin URI: https://optimus.io
|
9 |
License: GPLv2 or later
|
10 |
-
Version: 1.4.
|
11 |
*/
|
12 |
|
13 |
/*
|
7 |
Author URI: https://www.keycdn.com
|
8 |
Plugin URI: https://optimus.io
|
9 |
License: GPLv2 or later
|
10 |
+
Version: 1.4.2
|
11 |
*/
|
12 |
|
13 |
/*
|
readme.txt
CHANGED
@@ -99,8 +99,11 @@ Optimus optional support the conversion of images to the thrifty [*WebP* image f
|
|
99 |
|
100 |
== Changelog ==
|
101 |
|
|
|
|
|
|
|
102 |
= 1.4.1 =
|
103 |
-
*
|
104 |
|
105 |
= 1.4.0 =
|
106 |
* Added PNG in the free version and the manual optimization setting
|
99 |
|
100 |
== Changelog ==
|
101 |
|
102 |
+
= 1.4.2 =
|
103 |
+
* Allow to generate WebP images on already optimzed images (bulk optimizer)
|
104 |
+
|
105 |
= 1.4.1 =
|
106 |
+
* Improves bulk optimization error handling
|
107 |
|
108 |
= 1.4.0 =
|
109 |
* Added PNG in the free version and the manual optimization setting
|