DefaultImageFormatReader.php: GdImageFormatReader isn't from gd

This commit is contained in:
Zankaria 2025-03-17 22:43:24 +01:00
parent a1aefc0d6b
commit cd8d93ad05

View file

@ -0,0 +1,18 @@
<?php
namespace Vichan\Service\Media;
class DefaultImageFormatReader implements ImageFormatReader {
/**
* getimagesize() is agnostic of any image metadata.
* If e.g. the Exif Orientation flag is set to a value which rotates the image by 90 or 270 degress, index 0 and 1
* are swapped, i.e. the contain the height and width, respectively.
*/
public function getSizes(string $file_path): array {
$ret = \getimagesize($file_path);
if ($ret === false) {
throw new \RuntimeException("Could not read image sizes of '$file_path'");
}
return $ret;
}
}