Jump to content

Rotate image


Recommended Posts

I have been trying to rotate an image for a while now but I cant get it to work right. It seems to be rotating the image not the whole canvas.


I am trying to rotate the image, then resize it , then save it, and store the details in my db. The only thing I cant get working right is the rotation (it works but clips parts of the image and fills portions with black space. Must use GD as I don't have ImageMagic


Can anyone tell me how I can rotate the image and not loose any part of it due to hanging over the sides.


I will give you free advertising on the website I will be using this on if you can help me. http://myiphonebackgrounds.com I would be happy to give you a permanent banner along the side of all pages or put in the top banner rotation plus a friends site link.


my source variable is $oldImage and I would like to store the rotated image into that same image file. the size of the imgae is in $width and $height. for now I would like to rotate the image 90 or 270 degrees but in the future I would like to do more.


thank you for your time.

Link to comment
Share on other sites

It is rather trivial. You need to make your canvas BIGGER first, THEN rotate the image and finally CROP it to the correct size to remove the white/black extra space that was added.


That 's all.


Also, your site has a rather huge security bug...

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.