Forum Moderators: coopster

Message Too Old, No Replies

Image Cropping

Which function?

         

inveni0

6:19 pm on Mar 11, 2006 (gmt 0)

10+ Year Member



I'm curious if anyone knows which function you use in PHP to crop an image. Can you use imagecopy?

vincevincevince

6:29 pm on Mar 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use a combination of imagecreate an imagecopyresampled

inveni0

6:34 pm on Mar 11, 2006 (gmt 0)

10+ Year Member



Can you help with a bit more detail?

EDIT:

Actually, it appears that ImageCopyResampled does what I need. I'll start experiementing! Thanks.

vincevincevince

9:34 am on Mar 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Read the user notes below those functions at php.net - they have some good examples :)

I should have said imagecreatetruecolor not imagecreate - you should get better results.

inveni0

1:21 pm on Mar 12, 2006 (gmt 0)

10+ Year Member



I have already managed to get it working. I'm using it in conjunction with Flash to create a smooth, easy to use image size/cropping tool. It works really, really well.

Thanks for your help!

vincevincevince

9:36 pm on Mar 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I can see how that would work well with Flash - although - Flash can do that kind of resizing and cropping itself - which will be much faster user experience.

In the past I've made javascript based systems for selecting areas to crop or enlarge on an image, with PHP image functions as the back end.

inveni0

11:09 pm on Mar 12, 2006 (gmt 0)

10+ Year Member



Well, there's a significant amount of database integration I have to do with this. Instead of trying to import all of the variables into Flash, I simply use flash as a visual representation of what the user intends to do. Once they've made their decision, they submit just two or three variables to php and the php script handles all the database functions. I thought it would be less buggy to not integrate php into flash. (not to mention easier on my programming brain...the two languages are just similar enough that I get confused, lol)

bandman05

9:16 pm on Apr 10, 2006 (gmt 0)

10+ Year Member



invenio,

We are trying to do a similiar application where we want to allow people to upload an image into a flash movie. Rotate it, zoom, crop, etc. and then when complete pass the variables back to php to then execute what they have designed.

I'd be interested in seeing what you were able to accomplish because we are unsure how to deal with the zoom variable and how to pass the variables that tell exactly where the user wants to crop.

How did you get around those variables?