Source of file ThumbnailGenerator.php
Size: 0,891 Bytes - Last Modified: 2021-12-23T10:02:36+00:00
/var/www/docs.ssmods.com/process/src/src/Model/ThumbnailGenerator.php
1234567891011121314151617181920212223242526272829303132333435 | <?php namespace MadeHQ\Cloudinary\Model; use SilverStripe\AssetAdmin\Model\ThumbnailGenerator As BaseThumbnailGenerator; use SilverStripe\Assets\Storage\AssetContainer; class ThumbnailGenerator extends BaseThumbnailGenerator { /** * @inheritdoc */ public function generateThumbnailLink(AssetContainer $file, $width, $height, $graceful = false) { if (!($file instanceof File)) { return null; } if ((!$file->getIsImage() && !$file->getIsVideo()) || !$file->exists()) { return null; } $opts = [ 'resource_type' => $file->ResourceType, 'width' => $width, 'height' => $height, 'crop' => 'fill', 'type' => $file->Type, 'secure' => true, ]; return \Cloudinary::cloudinary_url($file->PublicID . '.png', $opts); } } |