Sunday, April 29, 2012

Verifying and Viewing Info on Your ImageMagick Installation in PHP

You will probably want to take a look at the basic package statistics for Imagick when getting to work with it.  This will provide you with the simple understanding that you have the right package and version numbers installed for PHP that you think you have :

(Note:  Imagick::getImageMagickLicense is a function that produces an error in PHP Version 5.2.17.)

The Politics:  This was originally posted with the ImageMagick class, but was then removed, either because it's too simple or because it points out another broken, undocumented function in PHP.

<?php

        // Grab and Display Copyright Information
        // ---------------------------------------------------

    $imagick_copyright = Imagick::getCopyright();
   
    print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><u>ImageMagick Copyright:</u></b><br>");
    print("$imagick_copyright<br>");
   
    print("<br>");
   
        // Grab and Display License Information
        // ---------------------------------------------------

//    $imagick_license = Imagick::getImageMagickLicense();
   
    print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><u>ImageMagick License:</u></b><br>");
    print("$imagick_license<br>");
   
    print("<br>");
   
        // Grab and Display Package Name Information
        // ---------------------------------------------------

    $imagick_package_name = Imagick::getPackageName();
   
    print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><u>ImageMagick Package Name:</u></b><br>");
    print("$imagick_package_name<br>");
   
    print("<br>");
   
        // Grab and Display Version Information
        // ---------------------------------------------------

    $imagick_version = Imagick::getVersion();
   
    $imagick_version_number = $imagick_version['versionNumber'];
    $imagick_version_string = $imagick_version['versionString'];
   
    print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><u>ImageMagick Version:</u></b><br>");
    print("Number: $imagick_version_number<br>");
    print("String: $imagick_version_string<br>");
   
    print("<br>");
   
        // Grab and Display Release Date Information
        // ---------------------------------------------------

    $imagick_release_date = Imagick::getReleaseDate();
   
    print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><u>ImageMagick Release Date:</u></b><br>");
    print("$imagick_release_date<br>");
   
    print("<br>");
   
        // Grab and Display Home URL Information
        // ---------------------------------------------------

    $imagick_homeurl = Imagick::getHomeURL();
   
    print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><u>ImageMagick Home URL:</u></b><br>");
    print("$imagick_homeurl<br>");

?>

Example Output:
(I had to disable the license option,
since it appears to be invalid on my
current install.)
---------------------------------------

        ImageMagick Copyright:
Copyright (C) 1999-2012 ImageMagick Studio LLC

        ImageMagick License:
ERROR -- Function not callable!

        ImageMagick Package Name:
ImageMagick

        ImageMagick Version:
Number: 1654
String: ImageMagick 6.7.6-1 2012-04-09 Q16 http://www.imagemagick.org

        ImageMagick Release Date:
2012-04-09

        ImageMagick Home URL:
/usr/[...Some URL on my Server]

Official Function Page: http://php.net/manual/en/book.imagick.php

// Note: All code appearing on the PHP Revolution blog by the blog owner is released under the Hacktivismo Enhanced-Source Software License Agreement (HESSLA), unless otherwise noted.  http://www.hacktivismo.com/about/hessla.php

No comments:

Post a Comment