0
이미지 미리보기 이미지가 표시되지만 배경이 black.i 인 이유를 이해할 수 없습니다.이 스크립트는 stackoverflow에서 발견되었습니다./: 은 GD의 library.i'm에서 문제를 사용하여 XAMPP업로드 된 이미지에서 검정색 배경을 표시하는 미리보기 이미지 만들기
makeThumbnails($upload_dir.$new_nm,227,182,$upload_dir_thumb.$new_nm);
function makeThumbnails($src,$w,$h,$dir)
{
$arr_image_details = getimagesize($src);
$original_width = $arr_image_details[0];
$original_height = $arr_image_details[1];
if ($original_width > $original_height) {
$new_width = $w;
$new_height = intval($original_height * $new_width/$original_width);
} else {
$new_height = $h;
$new_width = intval($original_width * $new_height/$original_height);
}
$dest_x = intval(($w - $new_width)/2);
$dest_y = intval(($h - $new_height)/2);
if ($arr_image_details[2] == 1) {
$imgt = "ImageGIF";
$imgcreatefrom = "ImageCreateFromGIF";
}
if ($arr_image_details[2] == 2) {
$imgt = "ImageJPEG";
$imgcreatefrom = "ImageCreateFromJPEG";
}
if ($arr_image_details[2] == 3) {
$imgt = "ImagePNG";
$imgcreatefrom = "ImageCreateFromPNG";
}
if ($imgt) {
$old_image = $imgcreatefrom($src);
$new_image = imagecreatetruecolor($w, $h);
imagecopyresized($new_image, $old_image, $dest_x, $dest_y, 0, 0, $new_width, $new_height, $original_width, $original_height);
$imgt($new_image, $dir);
}
으로 잘못하고 있다고 생각인가 /stackoverflow.com/questions/11376315/creating-a-thumbnail-from-an-uploaded-image –