You may use different software tools to manipulate images. Since I am working with PHP, this post is about image manipulation using PHP's inbuild functions, making your own classes or importing third party class libraries.
1. Important background. Mime types.
MIME types stands for Mulitpurpose Internet Mail Extension that has become the de facto standard for describing content types on the internet. When you are working with images, it is absolutely necessary that you specify and use the correct MIME type.
Examples:
Content type: image/jpeg (JPEG/JPG file type)
Content type: image/bmp (Windows bitmap .bmp)
Content type: image/xml+svg (Scalable Vector Graphics .svg)
Working with wrong or no MIME type may cause you a lot of trouble.
2. How can I manipulate images with the help of PHP?
You can do a lot more than you may imagine with
PHP's graphic functions like storing them in a variable, in a database as binary image data, resizing them, create watermarks, using images with text to stop bots from logging into your site etc. etc. And there are a lot of third party libraries with seamless classes that increase and extends PHP's image functions. Among the best known are
ImageMagick that comes with two books to explain the use of the classes and
JpGraph
3. Creating Thumnail images.
That is a five step process:
- Load the source variable into a PHP variable.
- Determine the hight and with of the original image.
- Create a blank thumbnail image of the correct size.
- Copy the original image to the blank thumbnail.
- Display the thumbnail using the correct content type.
4. Additional information and resources.
See
OopSchool under the heading: "PHP resources for image manipulation."