Jcrop .. doubts to save image

Asked

Viewed 191 times

0

I’m developing a system, and in it the user can cut an image (I did with jcrop) but after the user cuts it, it appears on the screen. What I’d like is that right after he cut it out, I can pick it up and save it in the uploads and save her link in the bd (that’s less the link), but I don’t really understand using images with php and I don’t know which of this information jcrop returns that I should use to save the image. Follow prints:

Here is only the HTML form:

Aqui é apenas o form HTML php that returns the cropped image o php que  retorna  a imagem recortada The cropped image he returns to me inserir a descrição da imagem aqui

1 answer

0

The 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';
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.