This is a way of figuring out wether of not you have GD installed and functioning on your web server.
When GD is available, you have access to a set of functions. The basic idea is to create a function that checks if those functions exist, by verifying the function gd_info that returns an array of supported or unsupported features.
The following code check if gd_info exists, then outputs each of its elements with its value. (YES if it's supported, NO is it's not supported)
| PHP Code |
|---|
<?php
function gdInfo()
{
// Check if the function gd_info exists (great way to know if gd is istalled)
if (function_exists("gd_info"))
{
echo "GD is supported. Here are some details:<br>";
$gd = gd_info();
// Show status of all values that might be supported(unsupported)
foreach ($gd as $key => $value)
{
echo " " . $key . ": ";
if ($value)
echo "YES<br>";
else
echo "NO< br>";
}
}
else
echo "GD is not supported";
}
?>
|
| Select all |
Paste the code into your script and call the function to check if your php version supports GD.
Nobody posted any comments regarding this story. Be the first!
Discuss