getimagesize(Array) [function.getimagesize]: failed to open stream: No such file or directory 정보
getimagesize(Array) [function.getimagesize]: failed to open stream: No such file or directory본문
외부 링크로 퍼온 이미지라도 경로에 data/cheditor4가 들어가면
썸네일을 추출하려고 해서 오류가 나는것 같습니다.
이미지 경로에 data/cheditor4가 들어간다고 해도 g4[path]로 한정시킨다던가 하면 될것 같은데..
도움 좀 부탁드립니다.
썸네일을 추출하려고 해서 오류가 나는것 같습니다.
이미지 경로에 data/cheditor4가 들어간다고 해도 g4[path]로 한정시킨다던가 하면 될것 같은데..
if (preg_match("/data\/cheditor4//썸네일 생성
$thumfile = "";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
// 업로드된 파일이 이미지라면
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($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_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
} else { //게디터에서 삽입한 이미지 뽑자ㅠㅠ
$edit_img = $list[$i]['wr_content'];
if (preg_match("/data\/cheditor4[^<>]*\.(gif|jp[e]?g|png|bmp)/i", $edit_img, $tmp)) { // data/cheditor4------
$file = './' . $tmp[0]; // 파일명
$file = explode("/data", $file); // 추가됨
$file = $g4['path']."/data".$file[1]; // 추가됨
$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_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
}
도움 좀 부탁드립니다.
댓글 전체

var_dump($list[$i][file][0]) 이런 식으로 해서 경로가 어떻게 지정되고 있나 확인해보세요
if (preg_match("/data\/cheditor4[^<>]*\.(gif|jp[e]?g|png|bmp)/i", $edit_img, $tmp)) {
$file = './' . $tmp[0]; // 파일명
$file = explode("/data", $file); // 추가됨
$file = $g4['path']."/data".$file[1]; // 추가됨
수정
$patt='@http://'.$_SERVER[HTTP_HOST].'(/data/cheditor[^>]+\.(gif|jp[e]?g|png))@i";
if(preg_match($patt, $list[$i]['wr_content'],$tmp) ){
$file = $g4['path']. $tmp[1];
$file = './' . $tmp[0]; // 파일명
$file = explode("/data", $file); // 추가됨
$file = $g4['path']."/data".$file[1]; // 추가됨
수정
$patt='@http://'.$_SERVER[HTTP_HOST].'(/data/cheditor[^>]+\.(gif|jp[e]?g|png))@i";
if(preg_match($patt, $list[$i]['wr_content'],$tmp) ){
$file = $g4['path']. $tmp[1];
답변 감사합니다.