6
I need to get the information inside the image with PHP, information like: Trademarks (or tags), Title, Comments, Authors and Copyright.
Does anyone know how to get this information using PHP?
6
I need to get the information inside the image with PHP, information like: Trademarks (or tags), Title, Comments, Authors and Copyright.
Does anyone know how to get this information using PHP?
3
Use the function exif_read_data
The function
exif_read_data()
reads the EXIF headers of a JPEG or TIFF image file. Returns an associative matrix where the indexes are the header names and the values are the values associated with these headers. If no data can be returned, then the result is FALSE.
To activate it in your php.ini
remove the ;
of the line:
If you are PHP 7.2 (windows, mac osx, linux):
;extension=exif
If Windows and version is earlier than PHP 7.2:
;extension=php_exif.dll
If Linux/Mac OSX and the version predates PHP 7.2:
;extension=exif.so
After removing the ;
, just staying:
extension=exif
or
extension=php_exif.dll
or
extension=exif.so
Restart server, Apache, Nginx, etc
Note that in Windows you need to enable mbstring as well, so in PHP 7.2:
extension=mbstring
In previous versions of PHP:
extension=php_mbstring.dll
Example of usage code:
$exif = exif_read_data('tests/test1.jpg', 'IFD0');
$exif = exif_read_data('tests/test2.jpg', 0, true);
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "$key.$name: $val<br />\n";
}
}
Note that PHP 7.2 added support for the following EXIF formats:
Reference: http://br.php.net/manual/en/function.exif-read-data.php
Browser other questions tagged php image markers
You are not signed in. Login or sign up in order to post.
Do you want to say that they are in the image properties? or that it is written in the image?
– Guilherme Lautert
Dear Carlos, something is missing in the answer from @Wallace? She solved your problem?
– Guilherme Nascimento