You are here

protected function AssetImageHelper::setFallbackThumbnail in Media: Acquia DAM 8

Sets a new default fallback image.

Parameters

string $uri: The URI to use as the fallback image.

Return value

string The URI that was used in case of a file rename.

1 call to AssetImageHelper::setFallbackThumbnail()
AssetImageHelper::getFallbackThumbnail in src/Service/AssetImageHelper.php
Get a fallback image to use for the thumbnail.

File

src/Service/AssetImageHelper.php, line 256

Class

AssetImageHelper
Class AssetImageHelper.

Namespace

Drupal\media_acquiadam\Service

Code

protected function setFallbackThumbnail($uri) {

  // Drupal core prevents generating image styles from module directories,
  // so we need to copy our placeholder to the files directory first.
  $source = $this
    ->getAcquiaDamModulePath() . '/img/webdam.png';
  if (!$this
    ->phpFileExists($uri)) {
    $uri = $this->fileSystem
      ->copy($source, $uri);
    if (!empty($uri)) {
      $this
        ->saveFallbackThumbnail($uri);
    }
  }
  return $uri;
}