Pimcore\Model\Asset\Image\Thumbnail\Config::setName PHP Method

setName() public method

public setName ( string $name )
$name string
    public function setName($name)
    {
        $this->name = $name;
        return $this;
    }

Usage Example

示例#1
0
 /**
  * @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);
 }
All Usage Examples Of Pimcore\Model\Asset\Image\Thumbnail\Config::setName