forked from leftypol/leftypol
19 lines
563 B
PHP
19 lines
563 B
PHP
|
<?php
|
||
|
namespace Vichan\Service\Media;
|
||
|
|
||
|
|
||
|
class GdImageFormatReader 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;
|
||
|
}
|
||
|
}
|