Jcrop .. doubt to save image

0

I am developing a system, and in it the user can make a cut of an image (which I did with jcrop) but after the user cuts it, it appears on the screen. What I would like was that shortly after I cut it, I can pick it up and save it in the uploads folder and save its link in the bd (this is the less the link), however I do not understand much of use images with php and I do not know which of these information that jcrop returns that I should use to save the image. Here are prints:

Here is just the HTML form:

phpthatreturnsthecroppedimage Thecroppedimageitreturnsme

    
asked by anonymous 11.09.2016 / 16:00

1 answer

0

Friend, you can put the following thing:

$valid_ext = array('jpeg', 'png', 'jpg', 'gif');
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $ext = strtolower(pathinfo($_FILES['img']['name'], PATHINFO_EXTENSION));
    if (in_array($ext, $valid_ext)) {
        $path = 'uploads/'. uniqid() . "." . $ext;
        echo "<img src='path' />";
    } else {
        echo 'Problema na extensao'; 
    }
} else {
    echo 'requisicao ruim';
}
    
11.09.2016 / 18:39