From 8381a5940334e18010848e452b500c66b35543d9 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Wed, 4 Oct 2023 16:56:03 +0200 Subject: [PATCH] Add EncodedImage::toFilePointer() --- src/EncodedImage.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/EncodedImage.php b/src/EncodedImage.php index a0461d84..d1014497 100644 --- a/src/EncodedImage.php +++ b/src/EncodedImage.php @@ -38,6 +38,15 @@ class EncodedImage return $this->data; } + public function toFilePointer() + { + $pointer = fopen('php://temp', 'rw'); + fputs($pointer, $this->toString()); + rewind($pointer); + + return $pointer; + } + public function __toString(): string { return $this->toString();