갤러리스킨에서 에디터로 올린사진 리스트에 이미지 안뜨는 경우 정보
갤러리스킨에서 에디터로 올린사진 리스트에 이미지 안뜨는 경우본문
아마 해결된 문제일 테지만 검색치라 찾지 못해 고민하다가 맹글어 봤습니다.
수정할 부분은 2부분입니다.
1) lib/common.php
get_list() 함수 안 $list['content'] = conv_content($list['wr_content'], $html); 구문 뒤 적당한 곳에 다음 소스 삽입해 주세요.
$img_tag = "/<img [^<>]*src\=[(\"|')]{0,1}([^(\"|')>]*)/i"; 
preg_match_all($img_tag,  $list['wr_content'], $matches);
$list['img'] = $matches[1][0];
저는 다음과 같이 했습니다. 
 if ($board['bo_use_list_content'])
 {
   $html = 0;
   if (strstr($list['wr_option'], "html1"))
   $html = 1;
   else if (strstr($list['wr_option'], "html2"))
   $html = 2;
   $list['content'] = conv_content($list['wr_content'], $html); 
 }
  
  //소스추가 : 에디터로 올라간 wr_content에서 이미지 태그 추출하는 부분
  $img_tag  = "/<img [^<>]*src\=[(\"|')]{0,1}([^(\"|')>]*)/i"; 
  preg_match_all($img_tag ,  $list['wr_content'], $matches);
  $list['img'] = $matches[1][0];
 
2)갤러리스킨/list.skin.php
다음 소스를 찾아 강조한 부분의 소스를 삽입합니다.
 // 썸네일 이미지가 존재하지 않는다면
 if (!file_exists($thumb))
 {
  
  $file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
  
  //소스추가 : 에디터로 저장된 사진의 썸네일을 만들기 위함
  if(!$list[$i][file][0][file]){
   $file = $list[$i]['img'];
   $find = strrpos($file,'data');
   $file ="../".substr($file,$find);   
  }
  
  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;
    .....이하생략....   
   }
}
그리고 다음 소스를 찾아서
if ( !$list[$i][file][0][file])
        $img = "<img src=$board_skin_path/img/no_image.gif>";
밑에 소스로 바꿔주세여...
if ( !$list[$i]['img'] && !$list[$i][file][0][file])
         $img = "<img src=$board_skin_path/img/no_image.gif>"; 로 수정하였습니다.
여기까지 구요 만약 에디터와 파일찾기로 이미지를 동시에 업로드하는 경우(..) 소스를 보시면 아시겠지만 에디터로 삽입한 이미지 썸네일이 생성되어 리스트에 출력됩니다.
 
3
댓글 14개



일단 차근히 찾아서 수정하고 있답니다.