Skip to content

Commit

Permalink
v3.3.0
Browse files Browse the repository at this point in the history
- fixed: rotated thumbnails due to Apple-related EXIF data
  • Loading branch information
LCweb-ita committed Sep 23, 2023
1 parent 9279528 commit f080323
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
9 changes: 4 additions & 5 deletions easy_wp_thumbs.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Easy WP thumbs v3.2.0
* Easy WP thumbs v3.3.0
* NOTE: Designed for use with PHP version 5.2 and up. Requires at least WP 3.5
*
* @author Luca Montanari (LCweb)
Expand All @@ -13,7 +13,7 @@

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


Expand Down Expand Up @@ -173,7 +173,7 @@ function easy_wp_thumb($img_src, $w_jolly = false, $h = false, $quality = 80, $a
// check for external leechers
ewpt_helpers::block_external_leechers();

// browser cache based onn URL
// browser cache based on URL
ewpt_helpers::manage_browser_cache($_SERVER['REQUEST_URI']);


Expand All @@ -183,8 +183,7 @@ function easy_wp_thumb($img_src, $w_jolly = false, $h = false, $quality = 80, $a

$ewpt = new easy_wp_thumbs;
$url = urldecode(trim($_REQUEST['src']));



$thumb = $ewpt->get_thumb($url, $params, false, $stream = true);
if(!$thumb) {
header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
Expand Down
8 changes: 6 additions & 2 deletions include/engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ private function load_image($img_src) {

// get data - url case
if(filter_var($img_src, FILTER_VALIDATE_URL) || strpos( str_replace('https://', 'http://', strtolower($img_src)), 'http://') !== false) {
$data = wp_remote_get($img_src, array('timeout' => 8, 'redirection' => 3));
$data = wp_remote_get($img_src, array('timeout' => 3, 'redirection' => 3));

// nothing got - use cURL
if(is_wp_error($data) || 200 != wp_remote_retrieve_response_code($data) || empty($data['body'])) {
Expand All @@ -360,7 +360,7 @@ private function load_image($img_src) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 8);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($ch, CURLOPT_URL, $img_src);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $followlocation);

Expand All @@ -385,6 +385,10 @@ private function load_image($img_src) {

$this->editor->ewpt_setup_img_data();
$this->mime = $this->editor->pub_mime_type; // safe mime

if(method_exists($this->editor, 'maybe_exif_rotate')) {
$this->editor->maybe_exif_rotate();
}
return true;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion include/imagick_editor_extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct($data, $img_src) {
$this->image = $imagick;
}
catch(Exception $e) {
echo $e; //debug
//echo $e; //debug
$this->image = false;
}

Expand Down
13 changes: 9 additions & 4 deletions include/status_panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,11 @@ public static function get($wrap_with_form = false) {
}
})
.catch(error => {
console.error(error);
document.getElementById("ewpt_ajax_response").innerHTML = "Easy WP Thumbs '. esc_attr__('error') .' "+ JSON.stringify(error);
document.getElementById("ewpt_wrapper").innerHTML = "";
if(error) {
console.error(error);
document.getElementById("ewpt_ajax_response").innerHTML = "Easy WP Thumbs '. esc_attr__('error') .' "+ JSON.stringify(error);
document.getElementById("ewpt_wrapper").innerHTML = "";
}
});
};
Expand Down Expand Up @@ -359,7 +361,9 @@ private static function success_message($has_cache_files = false) {

echo '
<div class="wrap">
<small class="alignright" data-ref="'. esc_attr(__FILE__) .'">v'. EWPT_VER.'</small>
<h2>Easy WP Thumbs - '. __('Connection Information', self::$multilang_key). '</h2>
<p>'. __('System properly set up!', self::$multilang_key) . $clean_cache_string .'</p>
<p>
Expand All @@ -368,7 +372,8 @@ private static function success_message($has_cache_files = false) {
<option value="">'. __('No optimization', self::$multilang_key). '</option>
<option value="webp" '. selected('webp', $optimization, false) .'>'. __('Create thumbnails in WEBP format', self::$multilang_key). '</option>
</select>
</p>';
</p>
</div>';

wp_die();
}
Expand Down

0 comments on commit f080323

Please sign in to comment.