Hello,
I'm new to this list, so I aplogize if this is not the place to
post this message.
I was using today the getimagesize()
function which takes a file
name. I was trying to take the size of an image decoded using
base64_decode from a string. So I have my decoded data in $data.
Now to apply getimagesize()
I need a file, so I saved $data to
a temporary file and everything worked. I then tried to avoid
the temporary file by using i/o streams, but I didn't manage to
do this.
Correct me if I am wrong, but from what I see there is no way
to create a memory stream using php://memory and also attach
a unique key to it. If that would be possible, I could create
a memory stream with a unique key, write the data into it and
then pass this memory stream name to the getimagesize()
function.
In this way, all functions requiring a file could be used on
a memory buffer.
Adrian Drumea
I'm new to this list, so I aplogize if this is not the place to
post this message.
It fits the php-general list better perhaps.
In this way, all functions requiring a file could be used on a memory
buffer.
You mean like this:
http://no.php.net/manual/en/wrappers.data.php ?
regards,
Derick
--
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org
Hello,
I'm new to this list, so I aplogize if this is not the place to
post this message.I was using today the
getimagesize()
function which takes a file
name. I was trying to take the size of an image decoded using
base64_decode from a string. So I have my decoded data in $data.
Now to applygetimagesize()
I need a file, so I saved $data to
a temporary file and everything worked. I then tried to avoid
the temporary file by using i/o streams, but I didn't manage to
do this.Correct me if I am wrong, but from what I see there is no way
to create a memory stream using php://memory and also attach
a unique key to it. If that would be possible, I could create
a memory stream with a unique key, write the data into it and
then pass this memory stream name to thegetimagesize()
function.In this way, all functions requiring a file could be used on
a memory buffer.
You could implement your own stream with stream_wrapper_register()
, and
then use URLs like "mycustomstream://12345678", and your stream
implementation could then extract the "12345678" part to use as a key,
for example.