diff --git a/core/lib/Drupal/Core/Image/Image.php b/core/lib/Drupal/Core/Image/Image.php index 3d99b21..3c4553f 100644 --- a/core/lib/Drupal/Core/Image/Image.php +++ b/core/lib/Drupal/Core/Image/Image.php @@ -104,9 +104,11 @@ public function getExtension() { // Extension may still be empty after calling processInfo(). This happens if // the image doesn't exists yet on disk, but only in memory as image - // resource. Try to extact the extension from the image source path. - if (empty($this->extension)) { - $this->extension = pathinfo($this->getSource(), PATHINFO_EXTENSION); + // resource. Try to extract the extension from the image source path. + if (empty($this->extension) && ($extension = pathinfo($this->getSource(), PATHINFO_EXTENSION))) { + if (in_array($extension, array('gif', 'jpg', 'png'))) { + $this->extension = $extension; + } } return $this->extension;