Imagick::getImageSize
(PECL imagick 2, PECL imagick 3)
Imagick::getImageSize — Returns the image length in bytes
警告
此函数在 Imagick 3.4.4 中被 废弃,强烈建议不要应用此函数。
说明
Returns the image length in bytes. Deprecated in favour of Imagick::getImageLength()
参数
此函数没有参数。
返回值
Returns an int containing the current image size.
+添加备注
用户贡献的备注 5 notes
Ricardo Cordts Monteiro ¶
15 years ago
Practical use to get the dimensions of the image:
<?php
$image = new Imagick($image_src);
$d = $image->getImageGeometry();
$w = $d['width'];
$h = $d['height'];
?>
benford at bluhelix dot com ¶
15 years ago
Try Imagick::getSize, Imagick::getImageWidth, or Imagick::getImageHeight if you are looking to get dimensions in pixels (rows, columns) of the current image.
murphy(at)murphyslantech(dot)de ¶
14 years ago
If you get an error or warning (when using strict settings for PHP), telling you, that this function should not be used anymore try getImageLength() instead ...
nikolaus ¶
15 years ago
If you're planning to stream imagick images via http, pay attention that this function may return the uncompressed image size, so it's not directly suitable for setting the content-length http header.
perching_eagle at yahoo dot com ¶
17 years ago
/* get the size of the image in bytes */
$image=new Imagick("c:/htdocs/rose.jpg");
$size=$image->getImageSize();
print "the size of the picture is ".$size." bytes";
result
the size of the picture is 3461 bytes