사용후기 사용자 첨부 이미지 썸네일로 출력되도록 수정

This commit is contained in:
chicpro
2014-05-20 18:19:23 +09:00
parent a201e5c70a
commit 83f8a43581
3 changed files with 53 additions and 4 deletions

View File

@ -2082,6 +2082,57 @@ function get_delivery_company($company)
return $option;
}
// 사용후기 썸네일 생성
function get_itemuselist_thumbnail($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;
}
//==============================================================================
// 쇼핑몰 라이브러리 모음 끝
//==============================================================================

View File

@ -40,7 +40,6 @@ add_stylesheet('<link rel="stylesheet" href="'.G5_MSHOP_SKIN_URL.'/style.css">',
$star = get_star($row['is_score']);
$is_content = get_view_thumbnail($row['is_content'], $thumbnail_width);
$small_image = $row['it_id'];
$row2 = sql_fetch(" select it_name from {$g5['g5_shop_item_table']} where it_id = '{$row['it_id']}' ");
$it_href = G5_SHOP_URL."/item.php?it_id={$row['it_id']}";
@ -51,7 +50,7 @@ add_stylesheet('<link rel="stylesheet" href="'.G5_MSHOP_SKIN_URL.'/style.css">',
<div class="sps_img">
<a href="<?php echo $it_href; ?>">
<?php echo get_it_image($small_image, 70, 70); ?>
<?php echo get_itemuselist_thumbnail($row['it_id'], $row['is_content'], 70, 70); ?>
<span><?php echo $row2['it_name']; ?></span>
</a>
</div>

View File

@ -40,7 +40,6 @@ add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_SKIN_URL.'/style.css">',
$star = get_star($row['is_score']);
$is_content = get_view_thumbnail($row['is_content'], $thumbnail_width);
$small_image = $row['it_id'];
$row2 = sql_fetch(" select it_name from {$g5['g5_shop_item_table']} where it_id = '{$row['it_id']}' ");
$it_href = G5_SHOP_URL."/item.php?it_id={$row['it_id']}";
@ -51,7 +50,7 @@ add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_SKIN_URL.'/style.css">',
<div class="sps_img">
<a href="<?php echo $it_href; ?>">
<?php echo get_it_image($small_image, 70, 70); ?>
<?php echo get_itemuselist_thumbnail($row['it_id'], $row['is_content'], 70, 70); ?>
<span><?php echo $row2['it_name']; ?></span>
</a>
</div>