문제

I'm cropping an image that was submitted through a form with a jQuery crop plugin. I have the following. But, how can I find out the path to the destination image?

$pic = $this->input->post('pic');

//Get the coordinates from the image crop
$x = $this->input->post('x');
$y = $this->input->post('y');
$w = $this->input->post('w');
$h = $this->input->post('h');

$src = imagecreatefromjpeg($pic);
$dest = ImageCreateTrueColor($w, $h);

imagecopy($dest, $src, $x, $y, $x, $y, $w, $h);
도움이 되었습니까?

해결책

You just need to declare the path.

imagejpeg($dest, '/path/to/save.jpg', 90);

or for smaller images

imagepng($dest, '/path/to/save.jpg', 9);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top