Jump to content

How do I create thumbnails on the page?


unplugged_web
 Share

Recommended Posts

This might not be the place to ask this, but from my understand of the GD library I can do this with PHP. What I want to do is have an image on a page that somebody can select a square area of (any size) and after click to say it's okay that area is saved to the server. If the selected area isn't right then they can move it around or select a different area altogether. I've no idea how to do this and wondered if anybody could help please. I've attached a couple of screen grabs to hopefully show better what I mean.

post-15405-0-77287600-1354184635_thumb.jpg

post-15405-0-38713400-1354184731_thumb.jpg

Link to comment
Share on other sites

It will nedd involvement of JS. There is many ways to do that. one would be, when user try to draw a square, they click on a place and keep on dragging the mouse. so you can catch click cordinates and mouseup cordinates. once you know the both co-ordinates you can calculate the length of between them and even the other two cordinate of rest of to points of square/rectangle (use cordinate geometry formulas). once you have four cordinates you can decide the real cordinates respective to the original image. So now you have original image dimension, crop box dimension. you can use those data to crop the image imagecopyresampled() and save it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...