Thumbnails

One of the main ways that people use the GD libraries is for creating thumbnails automatically upon image upload.
Getting PHP to receive a file from a client's computer is quite simple (even nowadays with the more secure $_FILES array access requirements) and can be used to good effect.
This section of the site deals entirely with procedures for thumbnailing either uploaded images, local (server) saved images or images pulled from other servers.

The thumbnails below all show an image which has been reduced and then manipulated through using a range of functions and scripts utilizing the GD2+ libraries. They have been bundled into a class file to make distribution easier, which can be assembled on this download page.

Bevel - to add a slightly raised or sunken effect to the thumbnail in question.
The width of bevel is variable as are the colours for both the top+left and base+right shading.
Motion Blur - A variable number of fading lines drifting from the thumbnail gives the effect of a slight motion blur.
Variables are used for the number of lines and the background colour.
Merge / Overlay - allows a variable opacity image to be drawn over the thumbnail at any defined location.
In addition, a colour can be set as transparent to allow the thumbnail to show through.
Greyscale - converting the image to a greyscaled (black and white) representation of itself.
The strength of red-green-blue channels can be set through passed variables.
Frame - a quite simple single colour picture frame is drawn around the thumbnail and given the effect of being raised by a lighter and darker edge.
With variables for light colour, dark colour and frame width.
Round Edges - used to take the harshness away from simple rectangular thumbnails, also offers a slight anti-alias on the corners.
Variables are used for the edge radius, the background colour and the anti-alias width.
Drop Shadow - as the name implies, a shadow effect fades from two edges of the thumbnail.
Will probably do a bit more work on this effect as I'm not overly happy with it yet.
Ellipse - Carving away the outer borders into the shape of an ellipse can work especially well on sites which use a more rounded design.
Currently used one variable for background colour, though I might add one for anti-alias strength.
It is possible to stack transformations on top of each other to create even more styled thumbnails, as the images below show.
Greyscale, Ellipse, Bevel and RoundEdges can be used together in sequence to create thumbnails with the effect shown to the left. Frame, MotionBlur and Merge can be used together to quite good effect as shown to the left.

Many other effects are possible.

 
SiteMap