public function HelperExtension::fileDataUri in Helper 8
Converts a file URL into a data URI.
Parameters
string $uri: The file URI.
bool $base_64_encode: TRUE to return the data URI as base-64 encoded content.
string|null $mimetype: The optional mime type to provide for the data URI. If not provided the mime type guesser service will be used.
Return value
string The image data URI for use in a src attribute.
File
- src/
Twig/ HelperExtension.php, line 59
Class
- HelperExtension
- Twig extension with some useful functions and filters.
Namespace
Drupal\helper\TwigCode
public function fileDataUri($uri, $base_64_encode = TRUE, $mimetype = NULL) {
return $this->fileHelper
->getDataUri($uri, $base_64_encode, $mimetype);
}