Magento: Rotate image
Here is a quick tip to rotate image to any degree of your choice in Magento. The rotate function of Varien_Image does the magic :)
Here goes the code:
$mainImage = Mage::getBaseDir('media') . DS . 'test' . DS . 'image.jpg';
$image = new Varien_Image($mainImage);
// rotate image with the angle of your choice
// save the image
$image->save(Mage::getBaseDir('media'). DS . 'test' . DS . 'new.jpg');
In the code above, you can see that I have an image named image.jpg inside media/test/ directory.
Then I have rotated the image to 90 degree.
The new rotated image is saved inside media/test/ directory as new.jpg.
Hope this helps. Thanks.