You are here

function media_thumbnails_svg_requirements in Media Thumbnails SVG 8

Implements hook_requirements().

File

./media_thumbnails_svg.install, line 11
Install, update and uninstall functions for the Media Thumbnails SVG module.

Code

function media_thumbnails_svg_requirements($phase) {
  $requirements = [];
  if ($phase === 'runtime') {
    switch (TRUE) {
      case strpos(shell_exec('gm'), 'GraphicsMagick') !== FALSE:
        $rasterizer = t('GraphicsMagick CLI tool detected. This should give you the best possible quality.');
        break;
      case strpos(shell_exec('convert'), 'ImageMagick') !== FALSE:
        $rasterizer = t('ImageMagick CLI tool detected. Quality might be improved by installing the <a href="http://www.graphicsmagick.org">GraphicsMagick</a> CLI Tool.');
        break;
      default:
        $rasterizer = t('PHP GD extension detected. Quality will be improved by installing the <a href="https://imagemagick.org">ImageMagick</a> or <a href="http://www.graphicsmagick.org">GraphicsMagick</a> CLI Tool.');
    }
    $requirements['rasterizer'] = [
      'title' => t('Media Thumbnails SVG Rasterizer'),
      'value' => $rasterizer,
      'severity' => REQUIREMENT_INFO,
    ];
  }
  return $requirements;
}