WebChemistry / images

Image storage for Nette Framework
36 stars 20 forks source link

How to get width and height of the resource? #35

Closed vylink closed 5 years ago

vylink commented 5 years ago

Hi,

is there any way of how to get image size (width and height) from the resource?

This is what I was using previously:

$bigImage->getNetteImageClass()->getWidth();

Bellow you can find a snippet of my current code:

$resource = $this->imageStorage->createResource('news/' . $dbImage->id . "-" . $dbImage->name);
$bigImage = $this->imageStorage->link($resource);

// how can I get width and height of the $bigImage here?

Cheers

krekos commented 5 years ago

If you using LocalStorage you can do this:

$imgSize = $this->imageStorage->getImageSize($resource); $imgSize->getWidth(); $imgSize->getHeight();

vylink commented 5 years ago

Fantastic. Thank you.