Getting thumbnails

Media Module

Media Module: Getting a thumbnail

If you want to get a specific thumbnail of an image you can have 2 choices. Either you're in a view, then you'll use the Facade, if not use class/method injection.


 * @var Imagy
private $imagy;

public function __construct(Imagy $imagy)
    $this->imagy = $imagy;

public function index()
    $thumbnail = $this->imagy->getThumbnail('/assets/media/original-image-name.png', 'smallThumb');


In views, you can use the facade for ease of use. Simply send as first argument which image you want and which thumbnail:

<img src="{{ Imagy::getThumbnail('/assets/media/original-image-name.png', 'smallThumb') }}" alt="" />

Mobile Analytics