Skip to content

Commit 6c642aa

Browse files
committed
2 parents 3db137e + efa0bf6 commit 6c642aa

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

phpthumb.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public function setSourceImageResource($gdimg) {
380380
public function setParameter($param, $value) {
381381
if ($param == 'src') {
382382
$this->setSourceFilename($this->ResolveFilenameToAbsolute($value));
383-
} elseif (@is_array($this->$param)) {
383+
} elseif (isset($this->$param) && is_array($this->$param)) {
384384
if (is_array($value)) {
385385
foreach ($value as $arraykey => $arrayvalue) {
386386
array_push($this->$param, $arrayvalue);
@@ -3731,7 +3731,7 @@ public function SetCacheFilename() {
37313731
} elseif (!$this->config_cache_source_filemtime_ignore_remote && preg_match('#^(f|ht)tps?\://#i', $this->src)) {
37323732
$this->cache_filename .= '_dat'. (int) phpthumb_functions::filedate_remote($this->src);
37333733
} elseif (!$this->config_cache_source_filemtime_ignore_local && $this->src && !$this->rawImageData) {
3734-
$this->cache_filename .= '_dat'. (int) (@filemtime($this->sourceFilename));
3734+
$this->cache_filename .= '_dat'. (int) (file_exists($this->sourceFilename) ? filemtime($this->sourceFilename) : 0);
37353735
}
37363736

37373737
$this->cache_filename .= '.'.strtolower($this->thumbnailFormat);

phpthumb.functions.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public static function exif_info() {
173173

174174

175175
public static function ImageTypeToMIMEtype($imagetype) {
176-
if (function_exists('image_type_to_mime_type') && ($imagetype >= 1) && ($imagetype <= 18)) {
176+
if (function_exists('image_type_to_mime_type') && ($imagetype >= 1) && ($imagetype <= 19)) {
177177
// PHP v4.3.0+
178178
return image_type_to_mime_type($imagetype);
179179
}
@@ -196,6 +196,7 @@ public static function ImageTypeToMIMEtype($imagetype) {
196196
16 => 'image/xbm', // IMAGETYPE_XBM
197197
17 => 'image/x-icon', // IMAGETYPE_ICO
198198
18 => 'image/webp', // IMAGETYPE_WEBP
199+
19 => 'image/avif', // IMAGETYPE_AVIF
199200

200201
'gif' => 'image/gif', // IMAGETYPE_GIF
201202
'jpg' => 'image/jpeg', // IMAGETYPE_JPEG
@@ -204,6 +205,7 @@ public static function ImageTypeToMIMEtype($imagetype) {
204205
'bmp' => 'image/bmp', // IMAGETYPE_BMP
205206
'ico' => 'image/x-icon', // IMAGETYPE_ICO
206207
'webp' => 'image/webp', // IMAGETYPE_WEBP
208+
'avif' => 'image/avif', // IMAGETYPE_AVIF
207209
);
208210

209211
return (isset($image_type_to_mime_type[$imagetype]) ? $image_type_to_mime_type[$imagetype] : false);
@@ -1047,8 +1049,8 @@ function preg_quote($string, $delimiter='\\') {
10471049
if (!function_exists('file_get_contents')) {
10481050
// included in PHP v4.3.0+
10491051
function file_get_contents($filename) {
1050-
if (preg_match('#^(f|ht)tp\://#i', $filename)) {
1051-
return SafeURLread($filename, $error);
1052+
if (preg_match('#^(ftp|https?)\://#i', $filename)) {
1053+
return phpthumb_functions::SafeURLread($filename, $error);
10521054
}
10531055
if ($fp = @fopen($filename, 'rb')) {
10541056
$rawData = '';

0 commit comments

Comments
 (0)