Skip to content

Commit 9f092df

Browse files
authored
Update ImageResize.php
I made a little mistake, now quality is ok
1 parent eecc36d commit 9f092df

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/ImageResize.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function imageCreateJpegfromExif($filename){
147147
public function save($filename, $image_type = null, $quality = null, $permissions = null)
148148
{
149149
$image_type = $image_type ?: $this->source_type;
150-
$quality = (int) abs($quality);
150+
$quality = is_numeric($quality) ? (int) abs($quality) : null;
151151

152152
switch ($image_type) {
153153
case IMAGETYPE_GIF:
@@ -203,15 +203,15 @@ public function save($filename, $image_type = null, $quality = null, $permission
203203
break;
204204

205205
case IMAGETYPE_JPEG:
206-
if ($quality === null || $quality < 0 || $quality > 100) {
206+
if ($quality === null || $quality > 100) {
207207
$quality = $this->quality_jpg;
208208
}
209209

210210
imagejpeg($dest_image, $filename, $quality);
211211
break;
212212

213213
case IMAGETYPE_PNG:
214-
if ($quality === null || $quality < 0 || $quality > 9) {
214+
if ($quality === null || $quality > 9) {
215215
$quality = $this->quality_png;
216216
}
217217

0 commit comments

Comments
 (0)