You are here

private function MediaWatermarkListBuilder::prepareImage in Media watermark 8

Helper to prepare image.

Parameters

$fids: List of file ids.

Return value

mixed

1 call to MediaWatermarkListBuilder::prepareImage()
MediaWatermarkListBuilder::buildRow in src/Controller/MediaWatermarkListBuilder.php
Builds a row for an entity in the entity listing.

File

src/Controller/MediaWatermarkListBuilder.php, line 53

Class

MediaWatermarkListBuilder
Provides a listing of Example.

Namespace

Drupal\media_watermark\Controller

Code

private function prepareImage($fids) {
  if (!empty($fids) && is_array($fids)) {
    $fid = reset($fids);
    $file = File::load($fid);
    $image = [
      '#theme' => 'image_style',
      '#width' => 200,
      '#height' => NULL,
      '#style_name' => 'media_watermark',
      '#uri' => $file
        ->getFileUri(),
    ];
    return render($image);
  }
}