영카트5 사용후기 썸네일
본문
현재 영카트 사용후기에 이미지를 첨부하면 첫번째 이미지를 가지고 썸네일이 생성이 되고 있습니다.
이를, 2번째도 썸네일이 생성되도록 하고 싶은데...
get_itemuselist_thumbnail2로 사용하여 2번째 첨부된 사진을 썸네일로 만들수 없을까요 ?
function get_itemuselist_thumbnail2($it_id, $contents, $thumb_width, $thumb_height, $is_create=false, $is_crop=true, $crop_mode='center', $is_sharpen=true, $um_value='80/0.5/3')
{
global $g5, $config;
$img = $filename = $alt = "";
if($contents) {
$matches = get_editor_image($contents, false);
for($i=0; $i<count($matches[1]); $i++)
{
// 이미지 path 구함
$p = parse_url($matches[1][$i]);
if(strpos($p['path'], '/'.G5_DATA_DIR.'/') != 0)
$data_path = preg_replace('/^\/.*\/'.G5_DATA_DIR.'/', '/'.G5_DATA_DIR, $p['path']);
else
$data_path = $p['path'];
$srcfile = G5_PATH.$data_path;
if(preg_match("/\.({$config['cf_image_extension']})$/i", $srcfile) && is_file($srcfile)) {
$size = @getimagesize($srcfile);
if(empty($size))
continue;
$filename = basename($srcfile);
$filepath = dirname($srcfile);
preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $matches[0][$i], $malt);
$alt = get_text($malt[1]);
break;
}
}
if($filename) {
$thumb = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, $is_create, $is_crop, $crop_mode, $is_sharpen, $um_value);
if($thumb) {
$src = G5_URL.str_replace($filename, $thumb, $data_path);
$img = '<img src="'.$src.'" width="'.$thumb_width.'" height="'.$thumb_height.'" alt="'.$alt.'">';
}
}
}
if(!$img)
$img = get_it_image($it_id, $thumb_width, $thumb_height);
return $img;
}
!-->
답변을 작성하시기 전에 로그인 해주세요.