열

모든 업로드 이미지의 썸네일 이미지 생성 완성후 문제 발생...

write_update.skin.php 파일에 아래소스를 사용하여 thumb라는 폴더내에
썸네일 이미지를 생성하게 했습니다... 헌데 삭제나 업데이트를 할때는 이미지가 삭제되거나 교체되지 않는다는 것입니다...

=====write_update.skin.php================================


$compre = '90';
$img_w = '120';
$img_h = '90';


$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';


for ($i=0; $i<count($_FILES[bf_file][name]); $i++)
{

$row = sql_fetch(" select * from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");

$img_id = $upload[$i][file];
$file = $data_path .'/'. $row[bf_file];
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file))
{
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;

//$rate = $img_w / $size[0];
//$height = (int)($size[1] * $rate);

@unlink($thumb_path.'/'.$img_id);
$dst = imagecreatetruecolor($img_w, $img_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_w, $img_h, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$img_id, $compre);
chmod($thumb_path.'/'.$img_id, 0606);
}
}


===========================================

write_update.php 와 delete.php 파일의 소스들을 활용하면 썸네일이미지를 주무를 수 있을 것 같은데 여기저기에다 붙여서 실행해봐도 잘안되네요...

고수님들의 도움 부탁 드립니다...^^;

댓글 2개

저 소스만으로 보면요...
@unlink($thumb_path.'/'.$img_id); 여기에서
$img_id의 값이 없습니다...즉 이미지가 없으니 삭제가 안되거나 수정이 안디는게 당연하지요;;;

즉 다시 말하자면...
$img_id = $upload[$i][file]; 에서 $upload[$i][file] 에 값이 없다는 말입니다.
$upload[$i][file] 에 정확한 이미지명이 들어온다면 삭제 될 것입니다.
답변 감사합니다...

그렇다면 해결책 힌트를 살짝 주시면...;;
댓글을 작성하시려면 로그인이 필요합니다.

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
06-01-01 조회 1,645
05-12-31 조회 1,244
에에페
05-12-31 조회 1,587
05-12-31 조회 1,587
에에페
05-12-31 조회 1,714
에에페
05-12-31 조회 1,594
05-12-31 조회 3,325
05-12-31 조회 1,736
05-12-31 조회 1,783
05-12-31 조회 1,615
05-12-31 조회 1,667
05-12-31 조회 1,591
05-12-31 조회 1,634
05-12-31 조회 1,657
05-12-31 조회 1,587
jjulia Kim
05-12-31 조회 1,968
05-12-30 조회 1,493
05-12-30 조회 1,647
05-12-30 조회 1,970
05-12-30 조회 1,438