var goodsSmallPic = "<?php echo IUrl::creatUrl("") . "views/" . $this->theme . "/skin/" . $this->skin . "/images/front/nopic_435_435.gif"; ?> "; var goodsBigPic = "<?php echo IUrl::creatUrl("") . "views/" . $this->theme . "/skin/" . $this->skin . "/images/front/nopic_435_435.gif"; ?> "; //存在图片数据时候 <?php if (isset($photo) && $photo) { ?> goodsSmallPic = "<?php echo IUrl::creatUrl("") . ""; echo Thumb::get($photo[0]['img'], 435, 435); ?> "; goodsBigPic = "<?php echo IUrl::creatUrl("") . ""; echo isset($photo[0]['img']) ? $photo[0]['img'] : ""; ?> "; <?php } ?> //初始化商品轮换图 var bxObj = $('#thumblist').bxSlider({ infiniteLoop: false, hideControlOnEnd: true,
/** * @brief 生成$fileName文件的缩略图,位置与$fileName相同 * @param string $fileName 要生成缩略图的目标文件 * @param int $width 缩略图宽度 * @param int $height 缩略图高度 * @param string $extName 缩略图文件名附加值 * @param string $saveDir 缩略图存储目录 */ public static function thumb($fileName, $width, $height, $extName = '_thumb', $saveDir = '') { return Thumb::get($fileName, $width, $height); }
/** * @brief 把cookie的结构转化成为程序所用的数据结构 * @param $cartValue 购物车cookie存储结构 * @return array : [goods]=>array( ['id']=>商品ID , ['data'] => array( [商品ID]=>array ([name]商品名称 , [img]图片地址 , [sell_price]价格, [count]购物车中此商品的数量 ,[type]类型goods,product , [goods_id]商品ID值 ) ) ) , [product]=>array( 同上 ) , [count]购物车商品和货品数量 , [sum]商品和货品总额 ; */ private function cartFormat($cartValue) { //初始化结果 $result = $this->cartExeStruct; $goodsIdArray = array(); if (isset($cartValue['goods']) && $cartValue['goods']) { $goodsIdArray = array_keys($cartValue['goods']); $result['goods']['id'] = $goodsIdArray; foreach ($goodsIdArray as $gid) { $result['goods']['data'][$gid] = array('id' => $gid, 'type' => 'goods', 'goods_id' => $gid, 'count' => $cartValue['goods'][$gid]); //购物车中的种类数量累加 $result['count'] += $cartValue['goods'][$gid]; } } if (isset($cartValue['product']) && $cartValue['product']) { $productIdArray = array_keys($cartValue['product']); $result['product']['id'] = $productIdArray; $productObj = new IModel('products'); $productData = $productObj->query('id in (' . join(",", $productIdArray) . ')', 'id,goods_id,sell_price'); foreach ($productData as $proVal) { $result['product']['data'][$proVal['id']] = array('id' => $proVal['id'], 'type' => 'product', 'goods_id' => $proVal['goods_id'], 'count' => $cartValue['product'][$proVal['id']], 'sell_price' => $proVal['sell_price']); if (!in_array($proVal['goods_id'], $goodsIdArray)) { $goodsIdArray[] = $proVal['goods_id']; } //购物车中的种类数量累加 $result['count'] += $cartValue['product'][$proVal['id']]; } } if ($goodsIdArray) { $goodsArray = array(); $goodsObj = new IModel('goods'); $goodsData = $goodsObj->query('id in (' . join(",", $goodsIdArray) . ')', 'id,name,img,sell_price'); foreach ($goodsData as $goodsVal) { $goodsArray[$goodsVal['id']] = $goodsVal; } foreach ($result['goods']['data'] as $key => $val) { $result['goods']['data'][$key]['img'] = Thumb::get($goodsArray[$val['goods_id']]['img'], 120, 120); $result['goods']['data'][$key]['name'] = $goodsArray[$val['goods_id']]['name']; $result['goods']['data'][$key]['sell_price'] = $goodsArray[$val['goods_id']]['sell_price']; //购物车中的金额累加 $result['sum'] += $goodsArray[$val['goods_id']]['sell_price'] * $val['count']; } foreach ($result['product']['data'] as $key => $val) { $result['product']['data'][$key]['img'] = Thumb::get($goodsArray[$val['goods_id']]['img'], 120, 120); $result['product']['data'][$key]['name'] = $goodsArray[$val['goods_id']]['name']; //购物车中的金额累加 $result['sum'] += $result['product']['data'][$key]['sell_price'] * $val['count']; } } return $result; }
$query->limit = "6"; $query->where = "co.status = 1 AND go.is_del = 0 AND go.id is not null"; $query->fields = "go.img as img,go.name as name,co.point,co.contents,co.goods_id"; $items = $query->find(); foreach ($items as $key => $item) { ?> <dl class="no_bg"> <?php $tmpGoodsId = $item['goods_id']; ?> <dt><a href="<?php echo IUrl::creatUrl("/site/products/id/{$tmpGoodsId}"); ?> "><img src="<?php echo IUrl::creatUrl("") . ""; echo Thumb::get($item['img'], 66, 66); ?> " width="66" height="66" /></a></dt> <dd><a href="<?php echo IUrl::creatUrl("/site/products/id/{$tmpGoodsId}"); ?> "><?php echo isset($item['name']) ? $item['name'] : ""; ?> </a></dd> <dd><span class="grade"><i style="width:<?php echo $item['point'] * 14; ?> px"></i></span></dd> <dd class="com_c"><?php echo isset($item['contents']) ? $item['contents'] : "";
<?php foreach ($this->resultData as $key => $item) { ?> <li class="clearfix <?php echo isset($this->show_type) ? $this->show_type : ""; ?> "> <div class="pic"> <a title="<?php echo isset($item['name']) ? $item['name'] : ""; ?> " href="<?php echo IUrl::creatUrl("/site/products/id/{$item['id']}"); ?> "><img src="<?php echo Thumb::get($item['img'], $this->listImageWidth, $this->listImageHeight); ?> " width="<?php echo isset($this->listImageWidth) ? $this->listImageWidth : ""; ?> " height="<?php echo isset($this->listImageHeight) ? $this->listImageHeight : ""; ?> " alt="<?php echo isset($item['name']) ? $item['name'] : ""; ?> " title="<?php echo isset($item['name']) ? $item['name'] : ""; ?> " /></a> </div>
public function thumb() { //配置参数 $imgSrc = IFilter::act(IReq::get('img'), 'filename'); $width = IFilter::act(IReq::get('w'), 'int'); $height = IFilter::act(IReq::get('h'), 'int'); if ($imgSrc && $width && $height && isset($_SERVER['HTTP_USER_AGENT'])) { $imgSrc = IFile::dirExplodeDecode($imgSrc); if (is_file($imgSrc)) { $thumbSrc = Thumb::get($imgSrc, $width, $height); $fileExt = pathinfo($thumbSrc, PATHINFO_EXTENSION); $mtime = filemtime($thumbSrc); $gmdate_mod = gmdate('D, d M Y H:i:s', $mtime) . ' GMT'; header('Last-Modified: ' . $gmdate_mod); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 60 * 60 * 24 * 30) . ' GMT'); header('Content-type: image/' . $fileExt); header('Content-Length: ' . filesize($thumbSrc)); readfile($thumbSrc); } } return ''; }
<?php /** * Reserved Route Lists * * @author veelasky <*****@*****.**> * @package pendopo/anchor */ Route::get("/proxy/thumb", array("as" => "proxy.thumb", function () { $input = Input::all(); return Thumb::get($input); }));