Version Description
- added a fix so relative paths to images are turned to absolute paths
Download this release
Release Info
Developer | ShortPixel |
Plugin | ShortPixel Image Optimizer |
Version | 2.1.10 |
Comparing to | |
See all releases |
Code changes from version 2.1.9 to 2.1.10
- readme.txt +5 -1
- wp-shortpixel.php +33 -5
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: AlexSP
|
|
4 |
Tags: picture, optimization, image editor, pngout, upload speed, shortpixel, compression, jpegmini, webp, lossless, cwebp, media, tinypng, jpegtran,image, image optimisation, shrink, picture, photo, optimize photos, compress, performance, tinypng, crunch, pngquant, attachment, optimize, pictures,fast, images, image files, image quality, lossy, upload, kraken, resize, seo, smushit, optipng, kraken image optimizer, ewww, photo optimization, gifsicle, image optimizer, images, krakenio, png, gmagick, image optimize, pdf, pdf optimisation, pdf optimization, optimize pdf, optimise pdf, shrink pdf, jpg, jpeg, jpg optimisation, jpg optimization, optimize jpg, optimise jpg, shrink jpg, gif, animated gif, optimize gif, optimise gif
|
5 |
Requires at least: 3.0.0 or higher
|
6 |
Tested up to: 4.2
|
7 |
-
Stable tag: 2.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -118,6 +118,10 @@ The ShortPixel team is here to help. <a href="https://shortpixel.com/contact">Co
|
|
118 |
|
119 |
== Changelog ==
|
120 |
|
|
|
|
|
|
|
|
|
121 |
= 2.1.9 =
|
122 |
|
123 |
* Check if the server address is localhost and warn when activating the API key.
|
4 |
Tags: picture, optimization, image editor, pngout, upload speed, shortpixel, compression, jpegmini, webp, lossless, cwebp, media, tinypng, jpegtran,image, image optimisation, shrink, picture, photo, optimize photos, compress, performance, tinypng, crunch, pngquant, attachment, optimize, pictures,fast, images, image files, image quality, lossy, upload, kraken, resize, seo, smushit, optipng, kraken image optimizer, ewww, photo optimization, gifsicle, image optimizer, images, krakenio, png, gmagick, image optimize, pdf, pdf optimisation, pdf optimization, optimize pdf, optimise pdf, shrink pdf, jpg, jpeg, jpg optimisation, jpg optimization, optimize jpg, optimise jpg, shrink jpg, gif, animated gif, optimize gif, optimise gif
|
5 |
Requires at least: 3.0.0 or higher
|
6 |
Tested up to: 4.2
|
7 |
+
Stable tag: 2.1.10
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
118 |
|
119 |
== Changelog ==
|
120 |
|
121 |
+
= 2.1.10 =
|
122 |
+
|
123 |
+
* added a fix so relative paths to images are turned to absolute paths
|
124 |
+
|
125 |
= 2.1.9 =
|
126 |
|
127 |
* Check if the server address is localhost and warn when activating the API key.
|
wp-shortpixel.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: ShortPixel Image Optimizer
|
4 |
* Plugin URI: https://shortpixel.com/
|
5 |
* Description: ShortPixel is an image compression tool that helps improve your website performance. The plugin optimizes images automatically using both lossy and lossless compression. Resulting, smaller, images are no different in quality from the original. To install: 1) Click the "Activate" link to the left of this description. 2) <a href="https://shortpixel.com/wp-apikey" target="_blank">Free Sign up</a> for your unique API Key . 3) Check your email for your API key. 4) Use your API key to activate ShortPixel plugin in the 'Plugins' menu in WordPress. 5) Done!
|
6 |
-
* Version: 2.1.
|
7 |
* Author: ShortPixel
|
8 |
* Author URI: https://shortpixel.com
|
9 |
*/
|
@@ -15,7 +15,7 @@ if ( !is_plugin_active( 'wpmandrill/wpmandrill.php' ) ) {
|
|
15 |
require_once( ABSPATH . 'wp-includes/pluggable.php' );//to avoid conflict with wpmandrill plugin
|
16 |
}
|
17 |
|
18 |
-
define('PLUGIN_VERSION', "2.1.
|
19 |
define('SP_DEBUG', false);
|
20 |
define('SP_LOG', false);
|
21 |
define('SP_MAX_TIMEOUT', 10);
|
@@ -236,7 +236,16 @@ class WPShortPixel {
|
|
236 |
update_option("wp-short-pixel-query-id-start", $ID);
|
237 |
|
238 |
self::log("Processing image id {$ID}");
|
239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
$path = get_attached_file($ID);
|
241 |
if(self::isProcessable($path) != false)
|
242 |
{
|
@@ -470,10 +479,22 @@ class WPShortPixel {
|
|
470 |
|
471 |
$imageIndex=0;
|
472 |
$ID = $itemDetails->post_id;
|
473 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
474 |
$imagePath = get_attached_file($ID);
|
475 |
$meta = wp_get_attachment_metadata($ID);
|
476 |
$uploadDir = wp_upload_dir();
|
|
|
|
|
|
|
|
|
|
|
477 |
|
478 |
if ( empty($meta['file']) )//file has no metadata attached (like PDF files uploaded before SP plugin)
|
479 |
{
|
@@ -513,7 +534,14 @@ class WPShortPixel {
|
|
513 |
public function handleManualOptimization() {
|
514 |
$attachmentID = intval($_GET['attachment_ID']);
|
515 |
|
516 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
517 |
$filePath[] = get_attached_file($attachmentID);
|
518 |
$meta = wp_get_attachment_metadata($attachmentID);
|
519 |
|
3 |
* Plugin Name: ShortPixel Image Optimizer
|
4 |
* Plugin URI: https://shortpixel.com/
|
5 |
* Description: ShortPixel is an image compression tool that helps improve your website performance. The plugin optimizes images automatically using both lossy and lossless compression. Resulting, smaller, images are no different in quality from the original. To install: 1) Click the "Activate" link to the left of this description. 2) <a href="https://shortpixel.com/wp-apikey" target="_blank">Free Sign up</a> for your unique API Key . 3) Check your email for your API key. 4) Use your API key to activate ShortPixel plugin in the 'Plugins' menu in WordPress. 5) Done!
|
6 |
+
* Version: 2.1.10
|
7 |
* Author: ShortPixel
|
8 |
* Author URI: https://shortpixel.com
|
9 |
*/
|
15 |
require_once( ABSPATH . 'wp-includes/pluggable.php' );//to avoid conflict with wpmandrill plugin
|
16 |
}
|
17 |
|
18 |
+
define('PLUGIN_VERSION', "2.1.10");
|
19 |
define('SP_DEBUG', false);
|
20 |
define('SP_LOG', false);
|
21 |
define('SP_MAX_TIMEOUT', 10);
|
236 |
update_option("wp-short-pixel-query-id-start", $ID);
|
237 |
|
238 |
self::log("Processing image id {$ID}");
|
239 |
+
|
240 |
+
//turn relative paths to absolute
|
241 |
+
if ( !parse_url(WP_CONTENT_URL, PHP_URL_SCHEME) )
|
242 |
+
{//no absolute URLs used -> we implement a hack
|
243 |
+
$url = get_site_url() . wp_get_attachment_url($ID);//get the file URL
|
244 |
+
}
|
245 |
+
else
|
246 |
+
$url = wp_get_attachment_url($ID);//get the file URL
|
247 |
+
|
248 |
+
|
249 |
$path = get_attached_file($ID);
|
250 |
if(self::isProcessable($path) != false)
|
251 |
{
|
479 |
|
480 |
$imageIndex=0;
|
481 |
$ID = $itemDetails->post_id;
|
482 |
+
//turn relative paths to absolute
|
483 |
+
if ( !parse_url(WP_CONTENT_URL, PHP_URL_SCHEME) )
|
484 |
+
{//no absolute URLs used -> we implement a hack
|
485 |
+
$imageURL = get_site_url() . wp_get_attachment_url($ID);//get the file URL
|
486 |
+
}
|
487 |
+
else
|
488 |
+
$imageURL = wp_get_attachment_url($ID);//get the file URL
|
489 |
+
|
490 |
$imagePath = get_attached_file($ID);
|
491 |
$meta = wp_get_attachment_metadata($ID);
|
492 |
$uploadDir = wp_upload_dir();
|
493 |
+
|
494 |
+
//generate absolute URL if needed
|
495 |
+
if ( !parse_url($uploadDir['baseurl'], PHP_URL_SCHEME) )
|
496 |
+
$uploadDir['baseurl'] = get_site_url() . $uploadDir['baseurl'];
|
497 |
+
|
498 |
|
499 |
if ( empty($meta['file']) )//file has no metadata attached (like PDF files uploaded before SP plugin)
|
500 |
{
|
534 |
public function handleManualOptimization() {
|
535 |
$attachmentID = intval($_GET['attachment_ID']);
|
536 |
|
537 |
+
//turn relative paths to absolute when needed
|
538 |
+
if ( !parse_url(WP_CONTENT_URL, PHP_URL_SCHEME) )
|
539 |
+
{//no absolute URLs used -> we implement a hack
|
540 |
+
$urlList[] = get_site_url() . wp_get_attachment_url($attachmentID);//get the file URL
|
541 |
+
}
|
542 |
+
else
|
543 |
+
$urlList[] = wp_get_attachment_url($attachmentID);//get the file URL
|
544 |
+
|
545 |
$filePath[] = get_attached_file($attachmentID);
|
546 |
$meta = wp_get_attachment_metadata($attachmentID);
|
547 |
|