Web Development Training System

Check GD Library Version and Test Copy Image Rotate

In this video we learn to write PHP scripts that target GD info array information to see what is installed on our server. We also fire up a few of the functions to test that GD is working by copying an image on the server and rotating it using one of the GD library functions. Script to display your GD library info. <?php $gdInfoArray = gd_info(); $version = $gdInfoArray["GD Version"]; echo "Your GD version is:".$version; echo "<hr />"; foreach ($gdInfoArray as $key => $value) { echo "$key | $value<br />"; } ?> This is the code we used to copy and rotate an image on the server. <?php // Let's target an image, copy it, rotate it, and save it $img = imagecreatefromjpeg("myPic.jpg"); $imgRotated = imagerotate($img, 45, -1); imagejpeg($imgRotated, "myPicRotated.jpg", 100); ?> <img src="myPic.jpg"/><img src="myPicRotated.jpg">