Open bscheshirwork opened 5 years ago
So... We can change a preview size and rules:
/**
* Widget preview height
* @var int
*/
public $previewHeight = 88;
/**
* Widget preview width
* @var int
*/
public $previewWidth = 130;
$this->versions['preview'] = function ($originalImage) {
$imagine = new \Imagine\Imagick\Imagine();
$image = $imagine->create(new \Imagine\Image\Box($this->previewWidth, $this->previewHeight));
/** @var ImageInterface $originalImage */
$thumbnail = $originalImage
->thumbnail(new Box($this->previewWidth, $this->previewHeight));
$size = $thumbnail->getSize();
return $image->paste($thumbnail, new \Imagine\Image\Point(floor(($this->previewWidth - $size->getWidth()) / 2), floor(($this->previewHeight - $size->getHeight()) / 2)));
};
This is some strange:
https://github.com/zxbodya/yii2-gallery-manager/blob/4a9ca72b36900195f34004926e593ed00cb91252/GalleryBehavior.php#L121-L127