In v2, we were able to get the width, height, and mime type of an image by using these:
<?= $file->width(); ?>
<?= $file->height(); ?>
<?= $file->mime(); ?>
None of those appear to be working anymore since updating to v3 and I’m not seeing any replacement in the documentation.
Any advice?
$file->dimensions()
gives you an array containing the width, height, ratio and orientation keys.
$file->mime()
will still work.
Ah, looks like it wasn’t working because I forgot to use toFile()
. I’m using $site->pwa_image()->toFile()->width()
and it’s still working.
Side note: It looks like this page is missing $file->width
and $file->height
.