Now that we have our file uploaded we can use CI's image class to manipulate it. This library works with the three most popular image libraries for PHP—GD/GD2, NetPBM
, and ImageMagick
. Use phpinfo()
to find which of these is supported by your server. Image watermarking only works with GD/GD2
, though:
The image manipulation class allows you to perform four basic functions with images:
Resize: You may want to fit them into a standard size on your screen or you may want to cut them right down to thumbnail images
Crop
Rotate
Watermark (only available with
GD/GD2
): This is often used to put a copyright notice on an image so that people can't download it from your site and pass it as their own work
Note
The GD
library is always needed in order to calculate image properties. You can use the library you want to manipulate the image.
First we will take a look at image resizing.
Note
Remember, for us to be able to manipulate the images, we will need to have write permissions for them.
First...