leftypol/inc/Data/Exif.php

24 lines
779 B
PHP

<?php
namespace Vichan\Data;
class Exif {
public const EXIF_ORIENTATION_0_UPRIGHT = 1;
public const EXIF_ORIENTATION_0_FLIPPED = 2;
public const EXIF_ORIENTATION_180_UPRIGHT = 3;
public const EXIF_ORIENTATION_180_FLIPPED = 4;
public const EXIF_ORIENTATION_90_UPRIGHT = 5;
public const EXIF_ORIENTATION_90_FLIPPED = 6;
public const EXIF_ORIENTATION_270_UPRIGHT = 7;
public const EXIF_ORIENTATION_270_FLIPPED = 8;
public const EXIF_ORIENTATION_UNDEFINED = 9;
/**
* Should you switch width and height since the image is on the side?
*
* @param int $exif_orientation An EXIF_ORIENTATION_* constant.
* @return boolean
*/
public static function exifOrientationOnSide(int $exif_orientation): bool {
return $exif_orientation >= 5 && $exif_orientation <= 8;
}
}