public function getDimensions()
{
if (!$this->width || !$this->height) {
$config = $this->getConfig();
$dimensions = [];
// generate the thumbnail and get dimensions from the thumbnail file
$info = @getimagesize($this->getFileSystemPath());
if ($info) {
$dimensions = ["width" => $info[0], "height" => $info[1]];
}
$this->width = $dimensions["width"];
$this->height = $dimensions["height"];
// the following is only relevant if using high-res option (retina, ...)
$this->realHeight = $this->height;
$this->realWidth = $this->width;
if ($config && $config->getHighResolution() && $config->getHighResolution() > 1) {
$this->realWidth = floor($this->width * $config->getHighResolution());
$this->realHeight = floor($this->height * $config->getHighResolution());
}
}
return ["width" => $this->width, "height" => $this->height];
}