/**
* @param null $thumbnailName
* @return mixed
*/
public function getThumbnail($thumbnailName = null)
{
if (!$this->getImage()) {
return "";
}
$crop = null;
if (is_array($this->getCrop())) {
$crop = $this->getCrop();
}
$thumbConfig = $this->getImage()->getThumbnailConfig($thumbnailName);
if (!$thumbConfig && $crop) {
$thumbConfig = new Asset\Image\Thumbnail\Config();
}
if ($crop) {
$thumbConfig->addItemAt(0, "cropPercent", array("width" => $crop["cropWidth"], "height" => $crop["cropHeight"], "y" => $crop["cropTop"], "x" => $crop["cropLeft"]));
$hash = md5(\Pimcore\Tool\Serialize::serialize($thumbConfig->getItems()));
$thumbConfig->setName($thumbConfig->getName() . "_auto_" . $hash);
}
return $this->getImage()->getThumbnail($thumbConfig);
}