diff --git a/lib/shop.lib.php b/lib/shop.lib.php index 74e8e65e7..6db357cb0 100644 --- a/lib/shop.lib.php +++ b/lib/shop.lib.php @@ -149,30 +149,33 @@ function get_it_thumbnail($img, $width, $height=0, $id='') } // -function get_it_imageurl($img, $width, $height=0) +function get_it_imageurl($it_id) { - $str = ''; + global $g4; + + $sql = " select it_img1, it_img2, it_img3, it_img4, it_img5, it_img6, it_img7, it_img8, it_img9, it_img10 + from {$g4['shop_item_table']} + where it_id = '$it_id' "; + $row = sql_fetch($sql); + $filepath = ''; + + for($i=1; $i<=10; $i++) { + $img = $row['it_img'.$i]; + $file = G4_DATA_PATH.'/item/'.$img; + if(!is_file($file)) + continue; - $file = G4_DATA_PATH.'/item/'.$img; - if(is_file($file)) $size = @getimagesize($file); + if($size[2] < 1 || $size[2] > 3) + continue; - 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); + $filepath = $file; } - $thumb = thumbnail($filename, $filepath, $filepath, $width, $height, false, false, 'center', true, $um_value='80/0.5/3'); - - if($thumb) - $str = str_replace(G4_PATH, G4_URL, $filepath.'/'.$thumb); + if($filepath) + $str = str_replace(G4_PATH, G4_URL, $filepath); + else + $str = G4_SHOP_URL.'/img/no_image.gif'; return $str; } diff --git a/shop/price/about.php b/shop/price/about.php index 7dc7fe27b..4ef8f5512 100644 --- a/shop/price/about.php +++ b/shop/price/about.php @@ -64,12 +64,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++) } // 상품이미지 - $img_url = ''; - for($k=1; $k<=10; $k++) { - $img_url = get_it_imageurl($row['it_img'.$k], $default['de_mimg_width'], $default['de_mimg_height']); - if($img_url) - break; - } + $img_url = get_it_imageurl($row['it_id']); echo "{$lt}{$row['it_id']}{$gt}"; // 쇼핑몰 상품ID echo "{$lt}C{$gt}"; // 상품구분 C/U/D 전체EP는 일괄적으로 C diff --git a/shop/price/about_new.php b/shop/price/about_new.php index 353d428df..e3ee792a8 100644 --- a/shop/price/about_new.php +++ b/shop/price/about_new.php @@ -65,12 +65,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++) } // 상품이미지 - $img_url = ''; - for($k=1; $k<=10; $k++) { - $img_url = get_it_imageurl($row['it_img'.$k], $default['de_mimg_width'], $default['de_mimg_height']); - if($img_url) - break; - } + $img_url = get_it_imageurl($row['it_id']); echo "{$lt}{$row['it_id']}{$gt}"; // 쇼핑몰 상품ID echo "{$lt}C{$gt}"; // 상품구분 C/U/D 전체EP는 일괄적으로 C diff --git a/shop/price/auction.php b/shop/price/auction.php index 31461fe0b..080e82f8c 100644 --- a/shop/price/auction.php +++ b/shop/price/auction.php @@ -93,12 +93,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++) } // 상품이미지 - $img_url = ''; - for($k=1; $k<=10; $k++) { - $img_url = get_it_imageurl($row['it_img'.$k], $default['de_mimg_width'], $default['de_mimg_height']); - if($img_url) - break; - } + $img_url = get_it_imageurl($row['it_id']); echo <<< HEREDOC {$lt}_BEGIN{$gt} diff --git a/shop/price/auction_new.php b/shop/price/auction_new.php index dc8d65c7e..e243ce0e3 100644 --- a/shop/price/auction_new.php +++ b/shop/price/auction_new.php @@ -96,12 +96,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++) } // 상품이미지 - $img_url = ''; - for($k=1; $k<=10; $k++) { - $img_url = get_it_imageurl($row['it_img'.$k], $default['de_mimg_width'], $default['de_mimg_height']); - if($img_url) - break; - } + $img_url = get_it_imageurl($row['it_id']); echo <<< HEREDOC {$lt}_BEGIN{$gt} diff --git a/shop/price/bb.php b/shop/price/bb.php index 0dbcce6fb..a2907360f 100644 --- a/shop/price/bb.php +++ b/shop/price/bb.php @@ -34,11 +34,7 @@ $sql = " select * from {$g4['shop_item_table']} $result = sql_query($sql); for ($i=0; $row=mysql_fetch_array($result); $i++) { - for($k=1; $k<=10; $k++) { - $imgage = get_it_imageurl($row['it_img'.$k], $default['de_mimg_width'], $default['de_mimg_height']); - if($image) - break; - } + $image = get_it_imageurl($row['it_id']); $row2 = sql_fetch(" select ca_name from {$g4['shop_category_table']} where ca_id = '".substr($row['ca_id'],0,2)."' "); diff --git a/shop/price/danawa.php b/shop/price/danawa.php index 967a8aa49..37aaa41c7 100644 --- a/shop/price/danawa.php +++ b/shop/price/danawa.php @@ -38,12 +38,7 @@ for ($i=0; $row=mysql_fetch_array($result); $i++) { } // 상품이미지 - $img_url = ''; - for($k=1; $k<=10; $k++) { - $img_url = get_it_imageurl($row['it_img'.$k], $default['de_mimg_width'], $default['de_mimg_height']); - if($img_url) - break; - } + $img_url = get_it_imageurl($row['it_id']); $str .= $nl; $str .= $row['it_id']; // 상품ID diff --git a/shop/price/daum.php b/shop/price/daum.php index 8cd1a322f..7edc67e59 100644 --- a/shop/price/daum.php +++ b/shop/price/daum.php @@ -135,12 +135,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++) } // 상품이미지 - $img_url = ''; - for($k=1; $k<=10; $k++) { - $img_url = get_it_imageurl($row['it_img'.$k], $default['de_mimg_width'], $default['de_mimg_height']); - if($img_url) - break; - } + $img_url = get_it_imageurl($row['it_id']); echo <<< HEREDOC {$lt}begin{$gt} diff --git a/shop/price/enuri.php b/shop/price/enuri.php index 60f7037f1..2fee4cfde 100644 --- a/shop/price/enuri.php +++ b/shop/price/enuri.php @@ -130,12 +130,7 @@ for ($i=0; $row=mysql_fetch_array($result); $i++) } // 상품이미지 - $img_url = ''; - for($k=1; $k<=10; $k++) { - $img_url = get_it_imageurl($row['it_img'.$k], $default['de_mimg_width'], $default['de_mimg_height']); - if($img_url) - break; - } + $img_url = get_it_imageurl($row['it_id']); echo '