Final Class Yiisoft\Validator\Rule\Image\NativeImageInfoProvider
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Yiisoft\ |
> PHP native function getimagesize() don't support HEIF / HEIC formats.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| get() | Yiisoft\ |
Method Details
| public ?\ | ||
| $path | string | |
public function get(string $path): ?ImageInfo
{
/**
* @psalm-var (array{0:int,1:int}&array)|false $data Need for PHP 8.0 only
*/
$data = @getimagesize($path);
if ($data === false) {
return null;
}
return new ImageInfo($data[0], $data[1]);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.