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(10) {
  ["date:create"]=>
  string(25) "2023-01-02T16:30:13+00:00"
  ["date:modify"]=>
  string(25) "2022-10-01T19:28:47+00:00"
  ["date:timestamp"]=>
  string(25) "2026-03-07T05:35:22+00:00"
  ["exif:InterColorProfile"]=>
  string(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(10) {
  [0]=>
  string(11) "date:create"
  [1]=>
  string(11) "date:modify"
  [2]=>
  string(14) "date:timestamp"
  [3]=>
  string(22) "exif:InterColorProfile"
  [4]=>
  string(13) "icc:copyright"
  [5]=>
  string(15) "icc:description"
  [6]=>
  string(16) "icc:manufacturer"
  [7]=>
  string(9) "icc:model"
  [8]=>
  string(15) "jpeg:colorspace"
  [9]=>
  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