protected function MediaThumbnailSVG::createThumbnailIM in Media Thumbnails SVG 8
1 call to MediaThumbnailSVG::createThumbnailIM()
- MediaThumbnailSVG::createThumbnail in src/
Plugin/ MediaThumbnail/ MediaThumbnailSVG.php - Creates a managed thumbnail file using the passed source file uri.
File
- src/
Plugin/ MediaThumbnail/ MediaThumbnailSVG.php, line 72
Class
- MediaThumbnailSVG
- Media thumbnail plugin for svg documents.
Namespace
Drupal\media_thumbnails_svg\Plugin\MediaThumbnailCode
protected function createThumbnailIM($path) {
$source = escapeshellarg($path);
$target = $source . '.png';
shell_exec("convert -background '{$this->bg_color}' -density {$this->width} -thumbnail {$this->width} -quality 100 -strip {$source} {$target}");
$data = file_get_contents($path . '.png');
if (!$data) {
$this->logger
->warning($this
->t('Could not create png from svg using IM.'));
}
return $data;
}