function webImageWithDetailLinkStars($image, $thumb_width, $thumb_height, $thumb_title = '', $thumb_class = '', $link_title = '', $detail_width = '500', $detail_height = '500', $stars = '0', $max_stars = '3', $link = '', $link_class = '', $brand_id = '', $obj_product = '') { global $DIAMOND_BRAND_IDS; $pimg = webImage($image, $thumb_width, $thumb_height, $thumb_title, $thumb_class); $main_image = webImageSource($image, $detail_width, $detail_height); $gold_icon = ''; $diamond_icon = ''; if ($main_image != '') { $link_target = $link != '' ? $link : $main_image; $link_class = $link_class != '' ? $link_class : 'view_image'; $pimg = '<a href="' . $link_target . '" class="' . $link_class . '"' . ($link_title == '' ? '' : ' title="' . $link_title . '"') . '>' . $pimg . '</a>'; $thumb_image_source = webImageSource($image, $thumb_width, $thumb_height); list($width, $height) = getimagesize($thumb_image_source); $icon_tpos = $height; $icon_lpos = $width; if (is_object($obj_product) && $obj_product->is_killed) { /*Displaying icon stack-ly please used this $icon_tpos -= 20; $icon_lpos = $width - 20; */ //Icon displayed on same row $icon_tpos = $height - 20; $icon_lpos -= 20; $killed_icon = drawKilledIcon('Killed Product', 'position:absolute;margin:' . $icon_tpos . 'px 0 0 ' . $icon_lpos . 'px'); } if (in_array($brand_id, $DIAMOND_BRAND_IDS) || is_object($obj_product) && in_array($obj_product->brand_id, $DIAMOND_BRAND_IDS)) { /*Displaying icon stack-ly please used this $icon_tpos -= 20; $icon_lpos = $width - 20; */ //Icon displayed on same row $icon_tpos = $height - 20; $icon_lpos -= 20; $diamond_icon = drawDiamondIcon('Diamond Product', 'position:absolute;margin:' . $icon_tpos . 'px 0 0 ' . $icon_lpos . 'px'); } if (is_object($obj_product) && ($obj_product->metal_stamp_code > 0 && $obj_product->metal_stamp_code != 925)) { /*Displaying icon stack-ly please used this $icon_tpos -= 20; $icon_lpos = $width - 25; */ //Icon displayed on same row $icon_tpos = $height - 20; $icon_lpos -= 25; $style = 'position:absolute;margin:' . $icon_tpos . 'px 0 0 ' . $icon_lpos . 'px'; $gold_icon = drawGoldIcon($obj_product->metal_stamp_code, $obj_product->metal_stamp_info, '', $style); } } $pimg = '<div align="center"><div style="width:' . $width . 'px;">' . $gold_icon . $diamond_icon . $killed_icon . $pimg . '<br/>' . drawStars($stars, $max_stars) . '</div></div>'; return $pimg; }
/** * Standard Display of Image Thumb with icons * @param int $width * @param int $height * @param string $additional_title * @param boolean $border * @param string $class * @param const $link_to IMAGE_LINKTO_BIGGER_IMAGE or IMAGE_LINKTO_PRODUCT_DETAIL * @return type */ public function displayImage($width, $height, $additional_title = '', $border = true, $class = '', $link_to = self::IMAGE_LINKTO_BIGGER_IMAGE) { $title = "Product {$this->id}"; if ($additional_title != '') { $title .= " {$additional_title}"; } $popup_title = 'View Larger Image (' . $this->id . '/' . $this->code . ')'; if ($additional_title != '') { $popup_title .= " {$additional_title}"; } $border_class = $border ? 'img-border' : ''; if ($border_class != $class) { $class .= ($class != '' ? ' ' : '') . $border_class; } //PREPARE THUMBNAIL $img_thumb = webImage($this->image, $width, $height, $popup_title, $class); $thumb_width = $width; $thumb_height = $height; if ($width == '' || $height == '') { $thumb_image_source = webImageSource($this->image, $width, $height); if ($thumb_image_source != '') { list($thumb_width, $thumb_height) = @getimagesize($thumb_image_source); } } //PREPARE LINK if ($link_to == self::IMAGE_LINKTO_BIGGER_IMAGE) { $main_image = webImageSource($this->image, IMAGE_SIZE_BIG_1); $link_target = $main_image != '' ? $main_image : ''; $link_class = 'view_image'; } else { $link_target = $this->getLinkProductDetail(); $link_class = 'view_webpage'; } if ($link_target != '') { $image = '<a href="' . $link_target . '" class="' . $link_class . '" title="' . $popup_title . '">' . $img_thumb . '</a>'; } else { $image = $img_thumb; } //PREPARE ICONS $icons_total_width = 0; $icons = array(); if ($this->isKilled()) { $icons[] = drawKilledIcon('Killed Product', ''); $icons_total_width += 16; } //DIAMOND ICON if ($this->isUsingDiamond()) { $icons[] = drawDiamondIcon('Diamond Product', ''); $icons_total_width += 16; } //GOLD ICON if ($this->isUsingGold()) { $icons[] = drawGoldIcon($this->metal_stamp_code, $this->metal_stamp_info); $icons_total_width += 21; } $icons_total_width += count($icons) * 2; //consider white space $icons_margin_top = $thumb_height - 16 - 1; //16 is default icon height, 1 is margin bottom $icons_margin_left = $thumb_width - $icons_total_width; $div_image = '<div>' . $image . '</div>'; $div_icons = '<div style="position:absolute;margin:' . $icons_margin_top . 'px 0 0 ' . $icons_margin_left . 'px;">' . implode(' ', array_reverse($icons)) . '</div>'; $div_stars = '<div>' . drawStars($this->stars) . '</div>'; return '<div class="tac" style="width:' . $thumb_width . 'px;margin:0 auto;">' . $div_icons . $div_image . $div_stars . '</div>'; }