Imagick::getImageWidth

(PECL imagick 2, PECL imagick 3)

Imagick::getImageWidth β€” Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ ΡˆΠΈΡ€ΠΈΠ½Ρƒ изобраТСния

ОписаниС

public function Imagick::getImageWidth(): int

Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ ΡˆΠΈΡ€ΠΈΠ½Ρƒ изобраТСния.

Бписок ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ΠΎΠ²

Π‘ΠΈΠ³Π½Π°Ρ‚ΡƒΡ€Π° Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ Π½Π΅ содСрТит ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ΠΎΠ².

Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅ΠΌΡ‹Π΅ значСния

Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ ΡˆΠΈΡ€ΠΈΠ½Ρƒ изобраТСния Π² пиксСлях.

Ошибки

Ѐункция выбрасываСт ΠΈΡΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΠ΅ ImagickException, Ссли Π²ΠΎΠ·Π½ΠΈΠΊΠ»Π° ошибка.

οΌ‹Π”ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ

ΠŸΡ€ΠΈΠΌΠ΅Ρ‡Π°Π½ΠΈΡ ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Π΅ΠΉ 3 notes

up
3
bob at majdak dot net ΒΆ
11 years ago
I am noticing that this is returning the original size of the image when it was opened, and not the size it may have been resized to with scaleImage or resizeImage.
up
1
terry ΒΆ
12 years ago
<?php

$image = new Imagick("picture.jpg");
$width = $image->getImageWidth();
print "the image width is " . $width . " pixels";

?>

Will print:
the image width is 200 pixels
up
0
nospam dot karst at onlinq dot nl ΒΆ
10 years ago
"bob at majdak dot net" mentioned that this function does not return the resized image size.

I use this function in production code, and it correctly returns the width for an image resized with `resizeImage()`. 
I have not tested it with `scaleImage()`.