Snippets - Utilities

Snippets index page

NOTE: Most of the IM snippets have been tested on IM version 6.3.5 There may be some differences if you are using the code on other versions.

Fonts installed - Anthony 15/6/2008

You can find which fonts are available to you in your standard installation by using the code below. ( NB: "font" replaced "type" in the latest release due to a name clash for the '-type' options list ).

  1. <?php
  2. // Select the version number from the configeration file
  3. preg_match('/^LIB_VERSION_NUMBER ([0-9,]+)$/m'shell_exec("convert -list configure "), $vnums);
  4. // Seperate the numbers at the ,
  5. $number explode","$vnums[1] );
  6. // Format the version from 6,3,4,1 format to 06030401
  7. $version "";
  8. for($i=0;$i<4;$i++)
  9. {
  10. $version .= str_pad$number[$i], 2'0'STR_PAD_LEFT );
  11. // The 'list' method used to get the fonts changed in IM v6.3.5-7
  12. $font_list = ( $version "06030507" ) ? "font" "type";
  13. // Display the version of Imagemagick, the method to read the fonts and the list of fonts
  14. echo "<h2>IM version: ".$version." </h2>\n
  15. <h3>Method used: convert -list $font_list</h3>\n
  16. <hr>\n<pre>";
  17. system("convert -list $font_list");
  18. echo "</pre>\n<hr>";
  19. ?>

For more examples and information check out the main Imagemagick section.

Batch file View

Fonts installed View

Fonts Installed view View

Gravity option View

http image source View

Image information View

New image size in variable View

Path - find automaticly View

Path to Imagemagick View

Setup Information View

Shell script View

Variables in the code View

Version of Imagemagick installed View

Writing IM code View