php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65187 exif_read_data : add support for stream resource
Submitted: 2013-07-02 21:47 UTC Modified: 2017-07-12 03:48 UTC
Votes:5
Avg. Score:4.6 ± 0.8
Reproduced:5 of 5 (100.0%)
Same Version:2 (40.0%)
Same OS:2 (40.0%)
From: imprec at gmail dot com Assigned: kalle (profile)
Status: Closed Package: EXIF related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: imprec at gmail dot com
New email:
PHP Version: OS:

 

 [2013-07-02 21:47 UTC] imprec at gmail dot com
Description:
------------
exif_read_data currently read exif metadata only from filepath. 

In case the image is in memory (stream resource, binary string, etc...) the image 
as to be written on disk before reading the exif data.

It would be awesome to be able to read from a stream resource.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-18 11:38 UTC] imprec at gmail dot com
-Status: Open +Status: Closed
 [2013-07-18 11:38 UTC] imprec at gmail dot com
Closing it as it's actually already supported via 

exif_read_data('data://image/jpeg;base64,'.base64_encode(file_get_contents('image.
jpg')))
 [2013-11-25 13:10 UTC] maggus dot staab at googlemail dot com
while the posted example will work, it requires a lot memory on php-side because you need to read the whole file + you need additional space for the base64 encoded string.

so its far away from an efficient solution and will not work for big/huge images.
 [2013-11-25 13:13 UTC] imprec at gmail dot com
-Status: Closed +Status: Open
 [2013-11-25 13:13 UTC] imprec at gmail dot com
After reading the comment of maggus dot staab at googlemail dot com, I reopen the ticket
 [2016-08-03 10:04 UTC] kalle@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: kalle
 [2016-08-03 10:04 UTC] kalle@php.net
It seems like all the exif_* functions do not support streams, I'm gonna take a look at it
 [2016-08-05 04:08 UTC] kalle@php.net
I'm currently working on a patch, and a side thing that is coming out of this is an additional $context parameter for use with non streams, since internally PHP is creating a stream with no context, this can help work around supplying direct addresses like locations thats gated by custom protocols or HTTPS which would need peer verification or similar.

I expect this patch to only go in PHP 7.2 and onwards.
 [2017-07-12 03:45 UTC] kalle@php.net
-Status: Assigned +Status: Closed
 [2017-07-12 03:45 UTC] kalle@php.net
I have just implemented this in master, it will be available as of PHP 7.2.0 Beta 1!

Thanks for helping PHP become EVEN greater!
 [2017-07-12 03:48 UTC] kalle@php.net
ps, it also works for exif_thumbnail()
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 08:01:28 2024 UTC