PHP 8.6.0 Beta 1 is available for testing

Imagick::getVersion

(PECL imagick 2, PECL imagick 3)

Imagick::getVersionReturns the ImageMagick API version

Description

public static function Imagick::getVersion(): array

Returns the ImageMagick API version as a string and as a number.

Parameters

This function has no parameters.

Return Values

Returns the ImageMagick API version as a string and as a number.

Errors/Exceptions

Throws ImagickException on error.

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes 3 notes

up
3
pasel at blueend dot com
12 years ago
You may check your version like this:
<?php
$v = Imagick::getVersion();
preg_match('/ImageMagick ([0-9]+\.[0-9]+\.[0-9]+)/', $v['versionString'], $v);
if(version_compare($v[1],'6.2.8')<=0){
 print "Your ImageMagick Version {$v[1]} is '6.2.8' or older, please upgrade!";
}
?>
up
2
mwu at digitaltorque dot com
15 years ago
Since it's not clear from the documention what this function returns:
print_r(imagick::getVersion());
Array
(
 [versionNumber] => 1632
 [versionString] => ImageMagick 6.6.0-4 2010年11月16日 Q16 http://www.imagemagick.org
)
up
0
holdoffhunger at gmail dot com
14 years ago
The getVersion function for the ImageMagick class returns an array, with two values, one linked to the key value of 'versionNumber' and another linked to the key value of 'versionString'. The version number provides a simple integer, while the string provides the actual x.y.z version number, the release date, and the URL for the ImageMagick site.
Today (May 8, 2012), when calling this function, the results are...
Number: 1654
String: ImageMagick 6.7.6-8 2012年05月02日 Q16 http://www.imagemagick.org
Last month (around April 15, 2012), when calling this function, the results were...
Number: 1654
String: ImageMagick 6.7.6-1 2012年04月09日 Q16 http://www.imagemagick.org
So, I'm not sure why the "Number" value has not changed, but the "String" value is definitely responding to changes in time.
The code for producing these results:
<?php
 // Author: holdoffhunger@gmail.com
 $imagick_version = Imagick::getVersion();
 
 $imagick_version_number = $imagick_version['versionNumber'];
 $imagick_version_string = $imagick_version['versionString'];
 print("Number: $imagick_version_number");
 print("<br>");
 print("String: $imagick_version_string");
?>
+add a note

AltStyle によって変換されたページ (->オリジナル) /