home | contact us
» Archive by category "gd"

category: gd


It is entirely possible and easy enough to create all kinds of charts and graphs using only PHP along with the GD library.

These days PHP is generally compiled with the GD library enabled so it is highly likely that you already have access to it. It is a powerful system, unfortunately often only used for creating thumbnail images.

For building management information systems with real time generated graphs there are some excellent classes available which will help you display information in a graphical and therefore easier to understand manner.

Checkout these great free graph classes:

Class: Google Graph
Class: Bar Graph generator
Class: Graph Drawing Class 2

However, sometime the graphics produced by GD simply are not flash enough for your application.

When you want something really flashy on your web site then you really can’t go wrong using flash.

There are a few flash graph packages you can purchase online for not too much cash. However if you prefer to keep it all open source then I highly recommend checking out this open source flash graph class.

Open Flash Chart project

Further Reading:

noteplog.com
bivald.com
blogs.sun.com
www.webappers.com
blogulate.com
www.linewbie.com
hotware.wordpress.com
wordpress.designpraxis.at
www.stat.columbia.edu


 

Many web masters will be familiar with Photoshop by Adobe. This highly featured photo editing and graphics application is incredibly powerful, but also incredibly expensive. If you find that the main thing you do with photoshop is basic product image cropping, resizing, trimming, rotating and watermarking then there is a better way!

If your server uses PHP and has GD functionality enabled, you can use the power of the GD library to automatically do all of these things for you. Furthermore the GD library is faster than using photoshop and as the process actually runs on your server, you do not have to worry about uploading files. Your employees can directly manipulate product photos from your web store administration screens.

Chances are the main thing you will need to do is to take one hi res source image and create one or more resized versions of it to be displayed as thumbnails or product info page images. Your Hi Res images can then be displayed as a pop up or lightbox.

There are many PHP GD thumbnail classes etc out there and you will easily find one by searching the major search engines.

Here are the basic concepts though:

1. Grab an image into memory from an external jpeg file
Before we can do anything we have to get an image into the memory. This then gives us something to work with.

//grab image into memory,  $img = full url to jpeg image
if(!$jpeg = imagecreatefromjpeg($img)){
echo '
<h2 style="color: red">Failed to Grab Image ' . $img . '</h2>
';
exit;
}

2. Manipulate Image however you want
There are all kinds of things you can do with the image you have loaded using the GD library.

3. Display the Image or Save to Disk
Once you have manipulated the image and have it looking the way you want, you can either serve it up or save it to the disk. Of course you can also do both if you prefer.

//save image
$save_path = 'Your Save Path';
imagejpeg($jpeg,$save_path);

//display image
header ("Content-Type: image/jpeg");
imagejpeg($jpeg);

//destroy image to free memory
imagedestroy($jpeg);

Related Resources
http://uk3.php.net/gd
http://www.phpclasses.org/browse/package/1365.html
http://www.phpit.net/article/image-manipulation-php-gd-part1/


 
rss icon