leftypol/inc/Service/Media/DefaultImageFormatReader.php

19 lines
568 B
PHP
Raw Normal View History

<?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;
}
}