Imagick::getImageProperties


wizard apg

RETURNS the image properties.



<?php

array public Imagick::getImageProperties(
                                            
string $pattern "*"
                                              
bool $include_values true);
      
?>

$pattern


The pattern for property names.



$include_values


Whether to return only property names.

If false then only property names will be returned.





This function returns an ARRAY on success.



  1 EXERCISE   

<?php

$path1 
PATH2IMGW '/jpg/1.jpg';

      
$img1 = new Imagick($path1);
      
$data1 $img1->getImageBlob();
       
       
$arr01 $img1->getImageProperties('*');
       
/* 
       or
       $arr01 = $img1->getImageProperties('*', true);
       */       
       
       
echo basename($path1);
       
      echo 
'<pre>';
      
var_dump($arr01);
      echo 
'</pre>';

?>

 RESULT   

1.jpg
array(9) {
  ["date:create"]=>
  string(25) "2023-01-02T16:30:13+00:00"
  ["date:modify"]=>
  string(25) "2022-10-01T19:28:47+00:00"
  ["exif:InterColorProfile"]=>
  string(4093) "0, 0, 12, 72, 76, 105, 110, 111, 2, 16, 0, 0, 109, 110, 116, 114, 82, 71, 66, 32, 88, 89, 90, 32, 7, 206, 0, 2, 0, 9, 0, 6, 0, 49, 0, 0, 97, 99, 115, 112, 77, 83, 70, 84, 0, 0, 0, 0, 73, 69, 67, 32, 115, 82, 71, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 246, 214, 0, 1, 0, 0, 0, 0, 211, 45, 72, 80, 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 99, 112, 114, 116, 0, 0, 1, 80, 0, 0, 0, 51, 100, 101, 115, 99, 0, 0, 1, 132, 0, 0, 0, 108, 119, 116, 112, 116, 0, 0, 1, 240, 0, 0, 0, 20, 98, 107, 112, 116, 0, 0, 2, 4, 0, 0, 0, 20, 114, 88, 89, 90, 0, 0, 2, 24, 0, 0, 0, 20, 103, 88, 89, 90, 0, 0, 2, 44, 0, 0, 0, 20, 98, 88, 89, 90, 0, 0, 2, 64, 0, 0, 0, 20, 100, 109, 110, 100, 0, 0, 2, 84, 0, 0, 0, 112, 100, 109, 100, 100, 0, 0, 2, 196, 0, 0, 0, 136, 118, 117, 101, 100, 0, 0, 3, 76, 0, 0, 0, 134, 118, 105, 101, 119, 0, 0, 3, 212, 0, 0, 0, 36, 108, 117, 109, 105, 0, 0, 3, 248, 0, 0, 0, 20, 109, 101, 97, 115, 0, 0, 4, 12, 0, 0, 0, 36, 116, 101, 99, 104, 0, 0, 4, 48, 0, 0, 0, 12, 114, 84, 82, 67, 0, 0, 4, 60, 0, 0, 8, 12, 103, 84, 82, 67, 0, 0, 4, 60, 0, 0, 8, 12, 98, 84, 82, 67, 0, 0, 4, 60, 0, 0, 8, 12, 116, 101, 120, 116, 0, 0, 0, 0, 67, 111, 112, 121, 114, 105, 103, 104, 116, 32, 40, 99, 41, 32, 49, 57, 57, 56, 32, 72, 101, 119, 108, 101, 116, 116, 45, 80, 97, 99, 107, 97, 114, 100, 32, 67, 111, 109, 112, 97, 110, 121, 0, 0, 100, 101, 115, 99, 0, 0, 0, 0, 0, 0, 0, 18, 115, 82, 71, 66, 32, 73, 69, 67, 54, 49, 57, 54, 54, 45, 50, 46, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 115, 82, 71, 66, 32, 73, 69, 67, 54, 49, 57, 54, 54, 45, 50, 46, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 88, 89, 90, 32, 0, 0, 0, 0, 0, 0, 243, 81, 0, 1, 0, 0, 0, 1, 22, 204, 88, 89, 90, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 88, 89, 90, 32, 0, 0, 0, 0, 0, 0, 111, 162, 0, 0, 56, 245, 0, 0, 3, 144, 88, 89, 90, 32, 0, 0, 0, 0, 0, 0, 98, 153, 0, 0, 183, 133, 0, 0, 24, 218, 88, 89, 90, 32, 0, 0, 0, 0, 0, 0, 36, 160, 0, 0, 15, 132, 0, 0, 182, 207, 100, 101, 115, 99, 0, 0, 0, 0, 0, 0, 0, 22, 73, 69, 67, 32, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 105, 101, 99, 46, 99, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 73, 69, 67, 32, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 105, 101, 99, 46, 99, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 101, 115, 99, 0, 0, 0, 0, 0, 0, 0, 46, 73, 69, 67, 32, 54, 49, 57, 54, 54, 45, 50, 46, 49, 32, 68, 101, 102, 97, 117, 108, 116, 32, 82, 71, 66, 32, 99, 111, 108, 111, 117, 114, 32, 115, 112, 97, 99, 101, 32, 45, 32, 115, 82, 71, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 73, 69, 67, 32, 54, 49, 57, 54, 54, 45, 50, 46, 49, 32, 68, 101, 102, 97, 117, 108, 116, 32, 82, 71, 66, 32, 99, 111, 108, 111, 117, 114, 32, 115, 112, 97, 99, 101, 32, 45, 32, 115, 82, 71, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 101, 115, 99, 0, 0, 0, 0, 0, 0, 0, 44, 82, 101, 102, 101, 114, 101, 110, 99, 101, 32, 86, 105, 101, 119, 105, 110, 103, 32, 67, 111, 110, 100, 105, 116, 105, 111, 110, 32, 105, 110, 32, 73, 69, 67, 54, 49, 57, 54, 54, 45, 50, 46, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 82, 101, 102, 101, 114, 101, 110, 99, 101, 32, 86, 105, 101, 119, 105, 110, 103, 32, 67, 111, 110, 100, 105, 116, 105, 111, 110, 32, 105, 110, 32, 73, 69, 67, 54, 49, 57, 54, 54, 45, 50, 46, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 101, 119, 0, 0, 0, 0, 0, 19, 164, 254, 0, 20, 95, 46, 0, 16, 207, 20, 0, 3, 237, 204, 0, 4, 19, 11, 0, 3, 92, 158, 0, 0, 0, 1, 88, 89, 90, 32, 0, 0, 0, 0, 0, 76, 9, 86, 0, 80, 0, 0, 0, 87, 31, 231, 109, 101, 97, 115, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 143, 0, 0, 0, 2, 115, 105, 103, 32, 0, 0, 0, 0, 67, 82, 84, 32, 99, 117, 114, 118, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 5, 0,"
  ["icc:copyright"]=>
  string(42) "Copyright (c) 1998 Hewlett-Packard Company"
  ["icc:description"]=>
  string(17) "sRGB IEC61966-2.1"
  ["icc:manufacturer"]=>
  string(21) "IEC http://www.iec.ch"
  ["icc:model"]=>
  string(45) "IEC 61966-2.1 Default RGB colour space - sRGB"
  ["jpeg:colorspace"]=>
  string(1) "2"
  ["jpeg:sampling-factor"]=>
  string(11) "1x1,1x1,1x1"
}


Original Image 90%

img/jpg/1.jpg apr

  2 EXERCISE   

<?php

$path2 
PATH2IMGW '/jpg/1.jpg';

      
$img2 = new Imagick($path2);
      
$data2 $img2->getImageBlob();
       
       
$arr02 $img2->getImageProperties('*'false);
       
       echo 
basename($path2);
       
      echo 
'<pre>';
      
var_dump($arr02);
      echo 
'</pre>';

?>

 RESULT   

1.jpg
array(9) {
  [0]=>
  string(11) "date:create"
  [1]=>
  string(11) "date:modify"
  [2]=>
  string(22) "exif:InterColorProfile"
  [3]=>
  string(13) "icc:copyright"
  [4]=>
  string(15) "icc:description"
  [5]=>
  string(16) "icc:manufacturer"
  [6]=>
  string(9) "icc:model"
  [7]=>
  string(15) "jpeg:colorspace"
  [8]=>
  string(20) "jpeg:sampling-factor"
}


Original Image 90%

img/jpg/1.jpg apr

  3 EXERCISE   

<?php

// Run several times

$path3 PATH2IMGW '/psd/14.psd';

      
$img3 = new Imagick($path3);
      
$data3 $img3->getImageBlob();
      
      echo 
basename($path3) . '<br><br>';
      
      
$s3 mt_rand(12);
      
if(
$s3 == 1)
{
       
$arr03 $img3->getImageProperties('*');
       echo 
'$include_values = true<br>';
}
else      
{
    
$arr03 $img3->getImageProperties('*'false);
    echo 
'$include_values = false<br>';
}   
      echo 
'<pre>';
      
var_dump($arr03);
      echo 
'</pre>';
      

?>

 RESULT   

Download the .psd file used in this exercise.
Click the below image:

apr