You are here

public function GDToolkitWebP::getMimeType in Picture 8

Returns the MIME type of the image file.

Return value

string The MIME type of the image file, or an empty string if the image is invalid.

Overrides GDToolkit::getMimeType

File

src/Plugin/ImageToolkit/GDToolkitWebP.php, line 157
Contains \Drupal\system\Plugin\ImageToolkit\GDToolkit.

Class

GDToolkitWebP
Defines the GD2 toolkit for image manipulation within Drupal.

Namespace

Drupal\picture\Plugin\ImageToolkit

Code

public function getMimeType() {
  switch ($this
    ->getType()) {
    case GDToolkitWebP::IMAGETYPE_WEBP:
      return 'image/webp';
    default:
      return $this
        ->getType() ? image_type_to_mime_type($this
        ->getType()) : '';
  }
}