DJ Mike's Tutorials: PHP

Images Pt.1

The first step to creating images is seeing what your server supports. To make images, PHP uses a library called GD. Different versions of PHP have different versions of GD bunded with it. In addition, some features, such as JPEG support require external libraries that your server may or may not have istalled. To find out what your server can do, use a function called gd_info like this:

<?
echo "<pre>";
print_rgd_info() );
echo 
"</pre>";
?>

That will return an associative array describing tour GD setup. If an index has a boolean true (1), your server supports that function. Here is what my server returns:

Array
(
    [GD Version] => bundled (2.0.34 compatible)
    [FreeType Support] => 1
    [FreeType Linkage] => with freetype
    [T1Lib Support] => 
    [GIF Read Support] => 1
    [GIF Create Support] => 1
    [JPG Support] => 1
    [PNG Support] => 1
    [WBMP Support] => 1
    [XPM Support] => 1
    [XBM Support] => 1
    [JIS-mapped Japanese Font Support] => 
)

As you can see, I can create .gif's, .jpg's and .png's. Not all servers can create all three. I have Freetype font support but not T1Lib (Type 1 fonts) support.

^ >


Created by DJ Mike from Santa Barbara

DJ Mike


Dance Away Santa Barbara's Home Page
<a href="http://www.statcounter.com/" target="_blank"> <img src="http://c5.statcounter.com/counter.php?sc_project=1321035&java=0&security=da2193dc" alt="counter free hit invisible" border="0" /></a>