CodeIgniter allows for the rotation of images; this is useful if you need to flip something vertically or in any other direction. Here's how it's done.
We're going to use a library of our own for this. If you haven't already done so (in the other recipes in this chapter), create the following file:
/path/to/codeigniter/application/libraries/image_manip.php
Ensure that the
image_manip
library class is defined as follows:<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Image_manip { }
Also ensure that you have the image library, ImageMagik, installed that you have this chapter's "base" recipe—that is Uploading images with CodeIgniter—already copied and ready to go, as this recipe uses the code from Uploading images with CodeIgniter as a base recipe.