Skip to content

Commit

Permalink
v3.1.2
Browse files Browse the repository at this point in the history
- fixed: GD resource check

(sorry but changelog from v.3.0 to actual one has been lost)
  • Loading branch information
LCweb-ita committed Jan 26, 2023
1 parent bb0036c commit 5ac6f11
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
10 changes: 5 additions & 5 deletions easy_wp_thumbs.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/**
* Easy WP thumbs v3.1
* Easy WP thumbs v3.1.2
* NOTE: Designed for use with PHP version 5.2 and up. Requires at least WP 3.5
*
* @author Luca Montanari aka LCweb
* @copyright 2021 Luca Montanari - https://lcweb.it
* @author Luca Montanari (LCweb)
* @copyright 2023 Luca Montanari - https://lcweb.it
*
* Licensed under the MIT license
*/
Expand All @@ -13,7 +13,7 @@

// be sure ewpt has not been initialized yet
if(!defined('EWPT_VER')) {
define('EWPT_VER', '3.1');
define('EWPT_VER', '3.1.2');
define('EWPT_ERROR_PREFIX', 'Easy WP Thumbs v'.EWPT_VER.' - ');


Expand Down Expand Up @@ -54,7 +54,7 @@
'500px.net',
'500px.org'
);
define('EWPT_ALLOW_EXTERNAL', $allowed_external); // (array) array of allowed websites where the script can fetch images
define('EWPT_ALLOW_EXTERNAL', serialize($allowed_external)); // (string) serialized array of allowed websites where the script can fetch images (to serialize against bad PHP versions)



Expand Down
2 changes: 1 addition & 1 deletion include/engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ private function check_source($img_src) {
}

$src_params = parse_url($img_src);
$sites = EWPT_ALLOW_EXTERNAL;
$sites = unserialize(EWPT_ALLOW_EXTERNAL);

// add the current URL
$sites[] = str_replace('www.', '', $_SERVER['HTTP_HOST']);
Expand Down
4 changes: 2 additions & 2 deletions include/gd_editor_extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ public function ewpt_img_fx($fx_array) {


/**
* Check if a valid imagick resource exists - in this case returns always true
* Check if a valid GD resource exists
*/
public function ewpt_is_valid_resource() {
return (!is_resource($this->image)) ? false : true;
return (!is_object($this->image)) ? false : true;
}


Expand Down
7 changes: 5 additions & 2 deletions include/imagick_editor_extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ class ewpt_editor_extension extends WP_Image_Editor_Imagick {
/* setup Imagick object */
public function __construct($data) {
$this->img_binary_data = $data;

if(empty($data)) {
return false;
}

try{
$imagick = new Imagick();
$response = $imagick->readImageBlob($data);
Expand Down Expand Up @@ -73,7 +76,7 @@ public function ewpt_setup_filename($path) {

/**
* Manage the resize and/or crop using the Timthumb v2.8.10 structure with imagick functions
* © Luca Montanari aka LCweb
* © Luca Montanari (LCweb)
*
* @param int $width width of the resized image
* @param int $height height of the resized image
Expand Down
6 changes: 3 additions & 3 deletions include/status_panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ public static function status_check($force_direct = false) {
private static function success_message($has_cache_files = false) {
echo '<div class="wrap">';

$clean_cache_string = ($has_cache_files) ? ' <a id="ewpt_clean_cache_trig" href="javascript:void(0)">('. __('Clean cache', $multilang_key) .')</a>' : '';
$clean_cache_string = ($has_cache_files) ? ' <a id="ewpt_clean_cache_trig" href="javascript:void(0)">('. __('Clean cache', self::$multilang_key) .')</a>' : '';

echo '<h2>Easy WP Thumbs - '. __('Connection Information', $multilang_key). '</h2>
<p>'. __('System properly set up!', $multilang_key) . $clean_cache_string .'</p><br/>';
echo '<h2>Easy WP Thumbs - '. __('Connection Information', self::$multilang_key). '</h2>
<p>'. __('System properly set up!', self::$multilang_key) . $clean_cache_string .'</p><br/>';

wp_die();
}
Expand Down
4 changes: 3 additions & 1 deletion include/wp_func_includes.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
require_once('imagick_editor_extension.php');
}
else {
require_once(ABSPATH .'wp-includes/class-wp-image-editor-gd.php');
include_once(ABSPATH .'wp-includes/class-wp-image-editor.php');
include_once(ABSPATH .'wp-includes/class-wp-image-editor-gd.php');

require_once('gd_editor_extension.php');
}

0 comments on commit 5ac6f11

Please sign in to comment.