Neos\Media\Domain\Model\Thumbnail::setWidth PHP Метод

setWidth() публичный Метод

public setWidth ( integer $width ) : void
$width integer
Результат void
    public function setWidth($width)
    {
        $this->width = (int) $width;
    }

Usage Example

 /**
  * @param Thumbnail $thumbnail
  * @return void
  * @throws Exception\NoThumbnailAvailableException
  */
 public function refresh(Thumbnail $thumbnail)
 {
     try {
         $adjustments = array(new ResizeImageAdjustment(array('width' => $thumbnail->getConfigurationValue('width'), 'maximumWidth' => $thumbnail->getConfigurationValue('maximumWidth'), 'height' => $thumbnail->getConfigurationValue('height'), 'maximumHeight' => $thumbnail->getConfigurationValue('maximumHeight'), 'ratioMode' => $thumbnail->getConfigurationValue('ratioMode'), 'allowUpScaling' => $thumbnail->getConfigurationValue('allowUpScaling'))));
         $processedImageInfo = $this->imageService->processImage($thumbnail->getOriginalAsset()->getResource(), $adjustments);
         $thumbnail->setResource($processedImageInfo['resource']);
         $thumbnail->setWidth($processedImageInfo['width']);
         $thumbnail->setHeight($processedImageInfo['height']);
     } catch (\Exception $exception) {
         $message = sprintf('Unable to generate thumbnail for the given image (filename: %s, SHA1: %s)', $thumbnail->getOriginalAsset()->getResource()->getFilename(), $thumbnail->getOriginalAsset()->getResource()->getSha1());
         throw new Exception\NoThumbnailAvailableException($message, 1433109654, $exception);
     }
 }
All Usage Examples Of Neos\Media\Domain\Model\Thumbnail::setWidth