GDToolkit::save()
contains the following code.
// Work around lack of stream wrapper support in imagejpeg() and imagepng().
if ($scheme && $this->streamWrapperManager->isValidScheme($scheme)) {
// If destination is not local, save image to temporary local file.
$local_wrappers = $this->streamWrapperManager->getWrappers(StreamWrapperInterface::LOCAL);
if (!isset($local_wrappers[$scheme])) {
$permanent_destination = $destination;
$destination = $this->fileSystem->tempnam('temporary://', 'gd_');
}
// Convert stream wrapper URI to normal path.
$destination = $this->fileSystem->realpath($destination);
}
As the comment says, that code workarounds the lack of support for stream wrappers in imagejpeg()
and imagepng()
, but those functions accept a stream resource since PHP 5.4, as the Changelog section of those functions says.
5.4.0 Added support for passing a stream resource to to.
That code should be removed, since Drupal 8 doesn't support PHP 5.4 anymore, and be replaced from code that passes a stream resource to the GD functions used to save an image.