Hi,

I have recieved many queries from people asking , how can they resize image in the fly using php.

Today I will explain how we can do it , but before we jump into code it has some prerequisite and constraint:

1) GD library should be installed on your server.

2) It works with only jpg and gif images.

IF you wondering how to make sure GD library is installed on your server , use the code below-

function GDCheck()
{
echo ” Status of GD support on your server: “;

// Check if the function gd_info exists (great way to know if gd is installed)
if(function_exists(“gd_info”))
{
echo “YES”;
$gd = gd_info();

// Show status of all values that might be supported(unsupported)
foreach($gd as $key => $value)
{
echo “–” . $key . “: “;
if($value)
echo “YES”;
else
echo “NO”;
}
}
else
echo “NO”;
}

GDCheck();
?>

Share