DJ Mike's Tutorials: PHP
Imagemagick Functions
^
- Description:
-
bool Imagick::pingImage ( string $filename )
This method can be used to query image width, height, size, and format without reading the whole image in to memory.
- Parameters
-
- filename
- The filename to read the information from.
- Return Values
-
Returns an array of information about the image.
Example
Ping Info
Array
(
[imageName] => /home/djmike/public_html/mike/tutorials/php/imagemagick/examples_05/opossum.jpg
[format] => JPEG (Joint Photographic Experts Group JFIF format)
[geometry] => Array
(
[width] => 176
[height] => 135
)
[resolution] => Array
(
[x] => 72
[y] => 72
)
[units] => PixelsPerInch
[type] => Bilevel
[colorSpace] => RGB
[compression] => JPEG
[fileSize] => 7.16kb
[rawOutput] => Image: /home/djmike/public_html/mike/tutorials/php/imagemagick/examples_05/opossum.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Class: DirectClass
Geometry: 176x135+0+0
Resolution: 72x72
Print size: 2.44444x1.875
Units: PixelsPerInch
Type: Bilevel
Base type: Bilevel
Endianess: Undefined
Colorspace: RGB
Rendering intent: Undefined
Interlace: None
Background color: white
Border color: rgb(223,223,223)
Matte color: grey74
Transparent color: black
Page geometry: 176x135+0+0
Dispose: Undefined
Iterations: 0
Compression: JPEG
Quality: 80
Orientation: Undefined
Properties:
create-date: 2012-02-08T01:41:02+00:00
jpeg:colorspace: 2
jpeg:sampling-factor: 2x1,1x1,1x1
modify-date: 2012-02-08T01:41:02+00:00
signature: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Tainted: False
Filesize: 7.16kb
Number pixels: 23.2kb
Version: ImageMagick 6.4.8 2009-09-04 Q16 OpenMP http://www.imagemagick.org
)
<?php
$image = new Imagick();
$ping = $image->pingImage("opossum.jpg");
$info = $image->identifyimage(TRUE);
echo "<h3>Ping Info</h3>";
echo "<pre>";
print_r($info);
echo "</pre>";
?>
^