영카트에서 상품에 마우스 오버시 2번째이미지
본문
상품 이미지 업로드시
10개까지 등록가능하잖아요,
상품 분류 리스트 페이지에서 상품 이미지에 마우스 오버시
2번째에 업로드한 이미지가 노출되게 하고싶습니다.
shop.lib.php 부분에서
onmouseover 를 사용해야 하는것같은데 자세한 소스구현이 너무 힘이듭니다.
친절히 답변해주시면 감사하겠습니다..
// 상품 이미지를 얻는다
function get_it_image($it_id, $width, $height=0, $anchor=false, $img_id='', $img_alt='')
{
global $g5;
if(!$it_id || !$width)
return '';
$sql = " select it_id, it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10 from {$g5['g5_shop_item_table']} where it_id = '$it_id' ";
$row = sql_fetch($sql);
if(!$row['it_id'])
return '';
for($i=1;$i<=10; $i++) {
$file = G5_DATA_PATH.'/item/'.$row['it_img'.$i];
if(is_file($file) && $row['it_img'.$i]) {
$size = @getimagesize($file);
if($size[2] < 1 || $size[2] > 3)
continue;
$filename = basename($file);
$filepath = dirname($file);
$img_width = $size[0];
$img_height = $size[1];
break;
}
}
if($img_width && !$height) {
$height = round(($width * $img_height) / $img_width);
}
if($filename) {
//thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_height, $is_create, $is_crop=false, $crop_mode='center', $is_sharpen=true, $um_value='80/0.5/3')
$thumb = thumbnail($filename, $filepath, $filepath, $width, $height, false, true, 'center', false, $um_value='80/0.5/3');
}
if($thumb) {
$file_url = str_replace(G5_PATH, G5_URL, $filepath.'/'.$thumb);
$img = '<img src="'.$file_url.'" width="'.$width.'" height="'.$height.'" alt="'.$img_alt.'"';
} else {
$img = '<img src="'.G5_SHOP_URL.'/img/no_image.gif" width="'.$width.'"';
if($height)
$img .= ' height="'.$height.'"';
$img .= ' alt="'.$img_alt.'"';
}
if($img_id)
$img .= ' id="'.$img_id.'"';
$img .= '>';
if($anchor)
$img = '<a href="'.G5_SHOP_URL.'/item.php?it_id='.$it_id.'">'.$img.'</a>';
return $img;
}
// 상품이미지 썸네일 생성
function get_it_thumbnail($img, $width, $height=0, $id='')
{
$str = '';
$file = G5_DATA_PATH.'/item/'.$img;
if(is_file($file))
$size = @getimagesize($file);
if($size[2] < 1 || $size[2] > 3)
return '';
$img_width = $size[0];
$img_height = $size[1];
$filename = basename($file);
$filepath = dirname($file);
if($img_width && !$height) {
$height = round(($width * $img_height) / $img_width);
}
$thumb = thumbnail($filename, $filepath, $filepath, $width, $height, false, true, 'center', false, $um_value='80/0.5/3');
if($thumb) {
$file_url = str_replace(G5_PATH, G5_URL, $filepath.'/'.$thumb);
$str = '<img src="'.$file_url.'" width="'.$width.'" height="'.$height.'"';
if($id)
$str .= ' id="'.$id.'"';
$str .= ' alt="">';
}
return $str;
}
답변 3
onmouseover 함수를 이용해 ajax로 해당이미지를 불러와서 집어넣어주세요
직접 하시는게 좋을듯 싶습니다.
foreach 문에서요 이미지값을 if문으로 받으시구요
그 다음에 각각 받은 변수들을 이용해서 자스 거거
소스를 달라고하시지마시고요~~ 못하시면 제작의뢰를 맡기세요.