You are here

public static function BlazyUtil::generatePlaceholder in Blazy 8.2

Generates an SVG Placeholder.

Parameters

string $width: The image width.

string $height: The image height.

Return value

string Returns a string containing an SVG.

2 calls to BlazyUtil::generatePlaceholder()
Blazy::urlAndDimensions in src/Blazy.php
Builds URLs, cache tags, and dimensions for an individual image.
BlazyManager::thumbnailAndPlaceholder in src/BlazyManager.php
Build thumbnails, also to provide placeholder for blur effect.

File

src/BlazyUtil.php, line 33

Class

BlazyUtil
Provides Blazy utilities.

Namespace

Drupal\blazy

Code

public static function generatePlaceholder($width, $height) : string {
  return 'data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D\'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg\'%20viewBox%3D\'0%200%20' . $width . '%20' . $height . '\'%2F%3E';
}