Skip to content

Commit 562228b

Browse files
committed
fix for 7.1
1 parent b5dce66 commit 562228b

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

.travis.yml

-19
This file was deleted.

lib/ImageResize.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,16 @@ public function __construct($filename)
111111

112112
$finfo = finfo_open(FILEINFO_MIME_TYPE);
113113
$checkWebp = false;
114-
if (strstr(finfo_file($finfo, $filename), 'image') === false || version_compare(PHP_VERSION, '7.1.0', '<')) {
115-
if (strstr(file_get_contents($filename), 'WEBPVP8') !== false) {
114+
if (strstr(finfo_file($finfo, $filename), 'image') === false) {
115+
if (version_compare(PHP_VERSION, '7.0.0', '<=') && strstr(file_get_contents($filename), 'WEBPVP8') !== false) {
116116
$checkWebp = true;
117117
$this->source_type = IMAGETYPE_WEBP;
118118
} else {
119119
throw new ImageResizeException('Unsupported file type');
120120
}
121+
} elseif(strstr(finfo_file($finfo, $filename), 'image/webp')) {
122+
$checkWebp = true;
123+
$this->source_type = IMAGETYPE_WEBP;
121124
}
122125

123126
if (!$image_info = getimagesize($filename, $this->source_info)) {

0 commit comments

Comments
 (0)