0

I have installed imagick library and checked using this command: php -m | grep imagick. It is working. but when I referred to the same reference,it is giving me blank array.

Here is my code:

    error_reporting(E_ALL);
    $incoming_file = '/var/www/html/demos/exif/tim.jpg';
    $img = new Imagick(realpath($incoming_file));
    $profiles = $img->getImageProfiles("icc", true);
    echo '<pre>';
    print_r($profiles); 

When I try to print $profiles nothing is returned. It gives me an empty array.

Reference Link for exif data in php

Muhammad usman
  • 521
  • 1
  • 3
  • 16
Bits Please
  • 877
  • 6
  • 23

1 Answers1

1

This will show you EXIF information from JPEG file in PHP. Try use relative path and check if script can read from this directory (permissions).

$uploadfile = "uploaded/pic.jpg";
$exif = exif_read_data($uploadfile, 0, true);
echo "<b>Your file</b><br />\n";
foreach ($exif as $key => $section) {
    foreach ($section as $name => $val) {
        echo "$key.$name: $val<br />\n";
    }
}

And this piece of code should delete all EXIF information

$img = new Imagick($uploadfile);
$img->stripImage();
$img->writeImage($uploadfile);

You can try it here: https://iconnaut.com/exif.php

buffy.cz
  • 66
  • 5