0.2, see readme.txt
This commit is contained in:
parent
b46481d78f
commit
ec16fd2fee
2 changed files with 49 additions and 12 deletions
|
@ -4,7 +4,7 @@ Donate link: https://paypal.me/petermolnar/3
|
||||||
Tags: image, cache, image quality,
|
Tags: image, cache, image quality,
|
||||||
Requires at least: 3.0
|
Requires at least: 3.0
|
||||||
Tested up to: 4.4
|
Tested up to: 4.4
|
||||||
Stable tag: 0.1
|
Stable tag: 0.2
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
Required minimum PHP version: 5.3
|
Required minimum PHP version: 5.3
|
||||||
|
@ -40,6 +40,11 @@ Version numbering logic:
|
||||||
* every .B version indicates new features.
|
* every .B version indicates new features.
|
||||||
* every ..C indicates bugfixes for A.B version.
|
* every ..C indicates bugfixes for A.B version.
|
||||||
|
|
||||||
|
= 0.2 =
|
||||||
|
*2016-03-01*
|
||||||
|
|
||||||
|
* setting resized images to be interlaced
|
||||||
|
|
||||||
= 0.1 =
|
= 0.1 =
|
||||||
*2015-12-10*
|
*2015-12-10*
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Plugin Name: wp-resized2cache
|
Plugin Name: wp-resized2cache
|
||||||
Plugin URI: https://github.com/petermolnar/wp-resized2cache
|
Plugin URI: https://github.com/petermolnar/wp-resized2cache
|
||||||
Description: Sharpen, enchance and move resized images to cache folder
|
Description: Sharpen, enchance and move resized images to cache folder
|
||||||
Version: 0.1
|
Version: 0.2
|
||||||
Author: Peter Molnar <hello@petermolnar.eu>
|
Author: Peter Molnar <hello@petermolnar.eu>
|
||||||
Author URI: http://petermolnar.eu/
|
Author URI: http://petermolnar.eu/
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
|
@ -140,6 +140,7 @@ class WP_RESIZED2CACHE {
|
||||||
$imagick->setImageFormat("jpg");
|
$imagick->setImageFormat("jpg");
|
||||||
$imagick->setImageCompression(Imagick::COMPRESSION_JPEG);
|
$imagick->setImageCompression(Imagick::COMPRESSION_JPEG);
|
||||||
$imagick->setImageCompressionQuality(static::jpeg_quality());
|
$imagick->setImageCompressionQuality(static::jpeg_quality());
|
||||||
|
$imagick->setInterlaceScheme(Imagick::INTERLACE_PLANE);
|
||||||
$imagick->writeImage($cached);
|
$imagick->writeImage($cached);
|
||||||
$imagick->destroy();
|
$imagick->destroy();
|
||||||
}
|
}
|
||||||
|
@ -173,23 +174,54 @@ class WP_RESIZED2CACHE {
|
||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param int $level
|
* @param int $level
|
||||||
|
*
|
||||||
|
* @output log to syslog | wp_die on high level
|
||||||
|
* @return false on not taking action, true on log sent
|
||||||
*/
|
*/
|
||||||
static function debug( $message, $level = LOG_NOTICE ) {
|
public static function debug( $message, $level = LOG_NOTICE ) {
|
||||||
|
if ( empty( $message ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
if ( @is_array( $message ) || @is_object ( $message ) )
|
if ( @is_array( $message ) || @is_object ( $message ) )
|
||||||
$message = json_encode($message);
|
$message = json_encode($message);
|
||||||
|
|
||||||
|
$levels = array (
|
||||||
|
LOG_EMERG => 0, // system is unusable
|
||||||
|
LOG_ALERT => 1, // Alert action must be taken immediately
|
||||||
|
LOG_CRIT => 2, // Critical critical conditions
|
||||||
|
LOG_ERR => 3, // Error error conditions
|
||||||
|
LOG_WARNING => 4, // Warning warning conditions
|
||||||
|
LOG_NOTICE => 5, // Notice normal but significant condition
|
||||||
|
LOG_INFO => 6, // Informational informational messages
|
||||||
|
LOG_DEBUG => 7, // Debug debug-level messages
|
||||||
|
);
|
||||||
|
|
||||||
switch ( $level ) {
|
// number for number based comparison
|
||||||
case LOG_ERR :
|
// should work with the defines only, this is just a make-it-sure step
|
||||||
wp_die( '<h1>Error:</h1>' . '<p>' . $message . '</p>' );
|
$level_ = $levels [ $level ];
|
||||||
exit;
|
|
||||||
default:
|
// in case WordPress debug log has a minimum level
|
||||||
if ( !defined( 'WP_DEBUG' ) || WP_DEBUG != true )
|
if ( defined ( 'WP_DEBUG_LEVEL' ) ) {
|
||||||
return;
|
$wp_level = $levels [ WP_DEBUG_LEVEL ];
|
||||||
break;
|
if ( $level_ < $wp_level ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
error_log( __CLASS__ . " => " . $message );
|
// ERR, CRIT, ALERT and EMERG
|
||||||
|
if ( 3 >= $level_ ) {
|
||||||
|
wp_die( '<h1>Error:</h1>' . '<p>' . $message . '</p>' );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$trace = debug_backtrace();
|
||||||
|
$caller = $trace[1];
|
||||||
|
$parent = $caller['function'];
|
||||||
|
|
||||||
|
if (isset($caller['class']))
|
||||||
|
$parent = $caller['class'] . '::' . $parent;
|
||||||
|
|
||||||
|
return error_log( "{$parent}: {$message}" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue