Display Cropped Image with PHP

Discussion in 'PHP' started by ups1984, Jun 27, 2013.

  1. #1
    Hi guys...i have used CSS, and JCrop to crop an image and save the width, height, x and y of the image in my MySQL DB. I am finding it hard to display the image now. Could someone please guide me?

    I tried using Imagick::cropImage but that didn't work.

    Any help would be appreciated.
     
    ups1984, Jun 27, 2013 IP
  2. edduvs

    edduvs Well-Known Member

    Messages:
    394
    Likes Received:
    31
    Best Answers:
    3
    Trophy Points:
    160
    #2
    As you didn't provide us any piece of code we can work with, I'll just try and guess what's going around.

    Firstly, what's the difference from your point of view between width,height and x,y , as I can't really figure what x and what y did you save.

    Secondly, why not just saving the image, if it's static into a folder, then display it to the users via a file named resize.php or whatever.

    I'll try to explain you the idea, or the structure of a php cropping script.
    1. Uploading the image
    2. File will check if the image is valid, will parse it's info, will give it a new name lets say some combo between userid and auto incremented uploaded image id.
    Eg: USERID_PHOTOID_TIMESTAMP.JPG / 12_182_1234567890.jpg

    3. Then it will attempt to save the cropped image , and in case of sucess, it inserts into the database (id,userid,path,dateline) values (182,12,'12_182_1234567890.jpg',1234567890)

    It can be simpler, without users, but the idea is the same, only the new name differs. The point is, you don't have to store any with nor height, nor x and y coordinates or whatever they are.
     
    edduvs, Jun 28, 2013 IP
  3. Pod2G

    Pod2G Member

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #3
    Use scripts with GD Library
     
    Pod2G, Jun 29, 2013 IP