downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Imagick::getImageProperty> <Imagick::getImageProfiles
[edit] Last updated: Fri, 25 May 2012

view this page in

Imagick::getImageProperties

(PECL imagick 2.0.0)

Imagick::getImagePropertiesRetourne les propriétés EXIF de l'image

Description

array Imagick::getImageProperties ([ string $pattern = "*" [, bool $only_names = true ]] )

Retourne toutes les propriétés de l'image, qui satisfont un modèle. Si TRUE est passé comme second paramètre, seul les noms des propriétés sont retournés. Cette méthode n'est disponible que si Imagick a été compilé avec ImageMagick version 6.3.6 ou supérieur.

Liste de paramètres

pattern

Le modèle pour les noms de propriétés.

only_names

S'il faut retourner uniquement les noms des propriétés. Si FALSE est fourni, alors les valeurs seront aussi retournées.

Valeurs de retour

Retourne un tableau contenant les propriétés de l'image, ou leurs noms.

Exemples

Exemple #1 Exemple avec Imagick::getImageProperties()

Exemple d'extraction d'informations EXIF.

<?php

/* Crée un objet */
$im = new imagick("/path/to/example.jpg");

/* Lit les informations EXIF */
$exifArray $im->getImageProperties("exif:*");

/* Passe en revue les propriétés EXIF */
foreach ($exifArray as $name => $property)
{
    echo 
"{$name} => {$property}<br />\n"
}

?>



Imagick::getImageProperty> <Imagick::getImageProfiles
[edit] Last updated: Fri, 25 May 2012
 
add a note add a note User Contributed Notes Imagick::getImageProperties
holdoffhunger at gmail dot com 20-May-2012 01:29
The getImageProperties function in PHP returns an array of property keys available for an image.  To get these property values, you use getImageProperty function, giving it one of the available keys provided by the getImageProperties function result.  For some images, you may have a lot of properties and for some, you may have few.  The two that almost every image seems to have are "date:create" and "date:modify", but some images may have forty or more properties, some titled "exif:Compression", "photoshop:Credit", "jpeg:colorspace", "rdf:Alt", "stRef:documentID", and "xap:CreatorTool."  PNG files will also have properties like "png:IHDR.bit_depth" and "png:IHDR.width,height."  So far, it appears generally that GIF and BMP files, being simpler, have fewer properties, whereas JPEG and PNG files, being more complicated, have much wider array of properties.  It seems incredibly useful in document management.

And now, some sample code and results :

<?php

           
// Author: holdoffhunger@gmail.com
   
        // Imagick Type
        // ---------------------------------------------

   
$imagick_type = new Imagick();
   
       
// Open File
        // ---------------------------------------------
       
   
$file_to_grab = "image_workshop_directory/test.png";
   
   
$file_handle_for_viewing_image_file = fopen($file_to_grab, 'a+');
   
       
// Grab File
        // ---------------------------------------------

   
$imagick_type->readImageFile($file_handle_for_viewing_image_file);
   
       
// Get Image Properties
        // ---------------------------------------------
       
   
$imagick_type_properties = $imagick_type->getImageProperties('*', FALSE);
   
       
// Print Image Properties
        // ---------------------------------------------
   
   
print("<pre>");
       
   
print_r($imagick_type_properties);
   
       
// Print Each Individual, Image Property
        // ---------------------------------------------
   
   
foreach($imagick_type_properties as $value)
    {
        print(
"$value --- ");
        print(
$imagick_type->getImageProperty("$value"));
        print(
"<br><br>");
    }
               
    print(
"</pre>");

?>

Results of this done on a standard PNG image :

Array
(
    [0] => date:create
    [1] => date:modify
    [2] => png:cHRM                
    [3] => png:gAMA                
    [4] => png:IHDR.bit_depth      
    [5] => png:IHDR.color_type     
    [6] => png:IHDR.interlace_method
    [7] => png:IHDR.width,height   
    [8] => png:sRGB                
)
date:create --- 2012-05-19T18:26:45-05:00

date:modify --- 2012-05-19T18:26:45-05:00

png:cHRM                  --- chunk was found (see Chromaticity, above)

png:gAMA                  --- gamma=0.45455 (See Gamma, above)

png:IHDR.bit_depth        --- 8

png:IHDR.color_type       --- 2

png:IHDR.interlace_method --- 0

png:IHDR.width,height     --- 320, 320

png:sRGB                  --- intent=0 (See Rendering intent)
www dot query at gmail dot com 08-Sep-2011 01:58
To access a photograph's EXIF data an alternative method is the normal PHP Exif function.

<?php

        $exif_data
= exif_read_data($pic1);
       
$edate = $exif_data['DateTime'];

?>

See: http://php.net/manual/en/book.exif.php
mhufford 03-Aug-2009 04:03
ImageMagick only supports setting a very small number of EXIF properties. 

See http://www.imagemagick.org/discourse-server/viewtopic.php?t=14234

 
show source | credits | sitemap | contact | advertising | mirror sites