이미지를 자르는이 스크립트가 있습니다. 어떻게 서버에 저장합니까?PHP로 자른 이미지 저장
move_uploaded_file($_FILES["file"]["tmp_name"],
"pictures/" . $_FILES["file"]["name"]);
$imgSrc = 'pictures/' . $_FILES["file"]["name"];
//getting the image dimensions
list($width, $height) = getimagesize($imgSrc);
//saving the image into memory (for manipulation with GD Library)
$myImage = imagecreatefromjpeg($imgSrc);
// calculating the part of the image to use for thumbnail
if ($width > $height) {
$y = 0;
$x = ($width - $height)/2;
$smallestSide = $height;
} else {
$x = 0;
$y = ($height - $width)/2;
$smallestSide = $width;
}
// copying the part into thumbnail
$thumbSize = 100;
$thumb = imagecreatetruecolor($thumbSize, $thumbSize);
imagecopyresampled($thumb, $myImage, 0, 0, $x, $y, $thumbSize, $thumbSize, $smallestSide, $smallestSide);
//final output
header('Content-type: image/jpeg');
imagejpeg($thumb);
이미지에서 볼 수 있듯이 출력 할 수 있습니다. 그러나 나는 그것을 구할 수 없습니다. 미리 :) 감사
자르기 후 어떤 유형의 이미지도 저장하고 싶습니다. 그래서 기본적으로 $ end 변수는 결국 저장해야합니다. –