SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Image crop and resize

    I'm looking for a script where I can upload an image and then crop this to a perfect square.
    The final image that is saved should be 200 x 200 pixels.
    So, if the uploaded image is too small, I want it to fill the rest of the area with white.
    If the uploaded file is too wide or too high, the user should be able to crop the part they want to be the visible 200x200 pixels.

    I found this script http://keithics.com/blog/jquery/ajax...-php-crop-tool
    But I don't understand where to change the bits and pieces to make it work for me.

    I want to make it simple and don't need the user input fields where they have to set the size and things like that.
    I just want them to use the upload button and the crop tool and then end up at another page where I can have their uploaded picture showing and also have the url to the image inserted into my db.

    Does anyone know what to change in this script or if there is something simple out there that might just do what I'm looking for?

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2011
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello brad62,

    I think Jquery Jcrop plugin might help you. Please google it.
    PHP Programming Itís more than just writing code

  3. #3
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thanx Jimmybrion. Testing that one as we speak. Looks great. I will see if I can make that one work.

  4. #4
    SitePoint Zealot wh33t's Avatar
    Join Date
    Aug 2011
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by brad62 View Post
    I'm looking for a script where I can upload an image and then crop this to a perfect square.
    The final image that is saved should be 200 x 200 pixels.
    So, if the uploaded image is too small, I want it to fill the rest of the area with white.
    If the uploaded file is too wide or too high, the user should be able to crop the part they want to be the visible 200x200 pixels.

    I found this script http://keithics.com/blog/jquery/ajax...-php-crop-tool
    But I don't understand where to change the bits and pieces to make it work for me.

    I want to make it simple and don't need the user input fields where they have to set the size and things like that.
    I just want them to use the upload button and the crop tool and then end up at another page where I can have their uploaded picture showing and also have the url to the image inserted into my db.

    Does anyone know what to change in this script or if there is something simple out there that might just do what I'm looking for?
    I have used a jQuery script to achieve that very result before and it was very sleek. However there is quite often some hefty PHP attached to pulling that off. Obviously jQuery itself cannot achieve this. Are you familiar at all with the GD library of PHP? It's truly incredible in the amount of things it can do. It was a bit of a learning curve for me but I'm very glad that I took the time to familiarize myself with it. Since then I have written an image.class that I can call upon, pass a few variables into it and achieve a whole plethora of functionality very quickly.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •