2025-03-17 22:21:38 +01:00
|
|
|
<?php
|
|
|
|
namespace Vichan\Service\Media;
|
|
|
|
|
|
|
|
|
2025-03-17 22:43:24 +01:00
|
|
|
class DefaultImageFormatReader implements ImageFormatReader {
|
2025-03-17 22:21:38 +01:00
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
}
|