Output\Image cleanup for phpstan

This commit is contained in:
Clemens Schwaighofer
2023-06-09 12:16:49 +09:00
parent e27ea3dc9f
commit 8a41db4649

View File

@@ -69,7 +69,7 @@ class Image
} }
// does this picture exist and is it a picture // does this picture exist and is it a picture
if (file_exists($filename) && is_file($filename)) { if (file_exists($filename) && is_file($filename)) {
[$width, $height, $type] = getimagesize($filename) ?: []; [$width, $height, $type] = getimagesize($filename) ?: [0, 0, null];
$convert_prefix = ''; $convert_prefix = '';
$create_file = false; $create_file = false;
$delete_filename = ''; $delete_filename = '';
@@ -98,7 +98,7 @@ class Image
if (!is_file($filename)) { if (!is_file($filename)) {
$filename .= '-0'; $filename .= '-0';
} }
[$width, $height, $type] = getimagesize($filename) ?: []; [$width, $height, $type] = getimagesize($filename) ?: [0, 0, null];
} }
// if no size given, set size to original // if no size given, set size to original
if (!$size_x || $size_x < 1) { if (!$size_x || $size_x < 1) {
@@ -117,7 +117,7 @@ class Image
$status = exec($convert_string, $output, $return); $status = exec($convert_string, $output, $return);
// get the size of the converted data, if converted // get the size of the converted data, if converted
if (is_file($thumbnail)) { if (is_file($thumbnail)) {
[$width, $height, $type] = getimagesize($thumbnail) ?: []; [$width, $height, $type] = getimagesize($thumbnail) ?: [0, 0, null];
} }
} }
if ($height > $size_y) { if ($height > $size_y) {
@@ -217,7 +217,7 @@ class Image
return $thumbnail; return $thumbnail;
} }
// $this->debug('IMAGE PREPARE', "FILENAME OK, THUMB WIDTH/HEIGHT OK"); // $this->debug('IMAGE PREPARE', "FILENAME OK, THUMB WIDTH/HEIGHT OK");
[$inc_width, $inc_height, $img_type] = getimagesize($filename) ?: []; [$inc_width, $inc_height, $img_type] = getimagesize($filename) ?: [0, 0, null];
$thumbnail_write_path = null; $thumbnail_write_path = null;
$thumbnail_web_path = null; $thumbnail_web_path = null;
// path set first // path set first
@@ -447,7 +447,7 @@ class Image
if (!function_exists('exif_read_data') || !is_writeable($filename)) { if (!function_exists('exif_read_data') || !is_writeable($filename)) {
return; return;
} }
[$inc_width, $inc_height, $img_type] = getimagesize($filename) ?: []; [$inc_width, $inc_height, $img_type] = getimagesize($filename) ?: [0, 0, null];
// add @ to avoid "file not supported error" // add @ to avoid "file not supported error"
$exif = @exif_read_data($filename); $exif = @exif_read_data($filename);
$orientation = null; $orientation = null;