Closed weierophinney closed 1 year ago
Summing up Slack discussion:
Currently, neither PHP 7.4 nor 8.0 with both resource
or GdImage
are properly functioning as both GdImage
and the resource
which are passed do not contain the image type. So should the image created as an PNG or a JPEG?
Lacking this information, using stream_get_contents
on the gdimage
resource will result in:
Warning: stream_get_contents(): supplied resource is not a valid stream resource
For PHP 8.0 and GdImage
, that error will slightly change to Warning: Uncaught TypeError: stream_get_contents(): Argument #1 ($stream) must be of type resource, GdImage given
.
So the whole image
feature is non-existent and therefore never worked. Won't be even a BC break by removing this feature tho.
Based on the Slack conversation and the feedback here, I'm going to close this patch, and then open a new one against 3.0.x to drop support for GD images in Stream
.
Description
Per discussion in #57, this patch does the following:
ImageStream
class as an extension ofStream
that only works withGdImage
resources.Stream
to emit anE_USER_DEPRECATED
error when used with aGdImage
resource, pointing users to the newImageStream
implementation.StreamFactory::createStreamFromResource()
to detectGdImage
resources, and to create and return anImageStream
when it does.The plan will be for 3.0.0 to remove support for
GdImage
fromStream
.