protected ImageStyle::addExtension($path)
Adds an extension to a path.
If this image style changes the extension of the derivative, this method adds the new extension to the given path. This way we avoid filename clashes while still allowing us to find the source image.
Parameters
string $path: The path to add the extension to.
Return value
string The given path if this image style doesn't change its extension, or the path with the added extension if it does.
File
- core/modules/image/src/Entity/ImageStyle.php, line 447
Class
- ImageStyle
- Defines an image style configuration entity.
Namespace
Drupal\image\Entity
Code
protected function addExtension($path) { $original_extension = pathinfo($path, PATHINFO_EXTENSION); $extension = $this->getDerivativeExtension($original_extension); if ($original_extension !== $extension) { $path .= '.' . $extension; } return $path; }
Please login to continue.