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

search for in the

Imagick::getImagesBlob> <Imagick::getImageRenderingIntent
[edit] Last updated: Fri, 24 May 2013

view this page in

Imagick::getImageResolution

(PECL imagick 2.0.0)

Imagick::getImageResolutionObtiene la resolución X e Y de la imagen

Descripción

array Imagick::getImageResolution ( void )

Obtiene la resolución X e Y de la imagen.

Valores devueltos

Devuelve la resolución como un array.

Errores/Excepciones

Lanza ImagickException en caso de error.



Imagick::getImagesBlob> <Imagick::getImageRenderingIntent
[edit] Last updated: Fri, 24 May 2013
 
add a note add a note User Contributed Notes Imagick::getImageResolution - [3 notes]
up
0
Shawn Pyle
2 years ago
As of the following versions, the results of this function returns the x and y resolution as floats.

desktop:~$ convert --version
Version: ImageMagick 6.6.9-1 2011-04-14 Q8 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP OpenCL

desktop:~$ pecl list
Installed packages, channel pecl.php.net:
==========================
Package Version State
imagick 3.0.1   stable

desktop:~$ php --version
PHP 5.3.5 (cli) (built: Mar  1 2011 12:57:53)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
up
0
perching_eagle at yahoo dot com
5 years ago
//location of image: c:/htdocs/rose.jpg
$path="c:/htdocs/";
$image=new Imagick($path."rose.jpg");
$array=$image->getImageResolution();
print_r($array);

result:
Array
(
    [x]=>75
    [y]=>75
)
up
-1
holdoffhunger at gmail dot com
1 year ago
If you're doing anything intensive with the ImageMagick class, then you're going to be working with the resolution of the image a lot.  In my install of PHP v.5.2.17, this function returns incorrect values, but a replacement function is easy to write by using a combination of the getImageHeight and getImageWidth properties, like so :

<?php

       
// Grab Image File Data
        // ---------------------------------------------
       
   
$file_to_grab_with_location = "image_workshop_directory/test.bmp";
   
   
$imagick_type = new Imagick();
   
       
// Open File
        // ---------------------------------------------
   
   
$file_handle_for_viewing_image_file = fopen($file_to_grab_with_location, 'a+');
   
   
$imagick_type->readImageFile($file_handle_for_viewing_image_file);

       
// Create Resolution Array
        // ---------------------------------------------

   
$imagick_type_resolution = array();

       
// Give Resolution Array Proper Values
        // ---------------------------------------------

   
$imagick_type_resolution['x'] = $imagick_type->getImageWidth();
   
$imagick_type_resolution['y'] = $imagick_type->getImageHeight();

       
// Output
        // ---------------------------------------------

   
print_r($imagick_type_resolution);

?>

Results of the Output:

Array
(
    [x] => 600
    [y] => 450
)

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