• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP thumb函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中thumb函数的典型用法代码示例。如果您正苦于以下问题:PHP thumb函数的具体用法?PHP thumb怎么用?PHP thumb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了thumb函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_recommend_goods_listOp

 /**
  * 获取推荐商品列表
  */
 public function get_recommend_goods_listOp()
 {
     $recommend_goods_list = Model('goods_class')->getGoodsClassListByParentId(0);
     if ($recommend_goods_list) {
         $model_goods = Model('goods');
         foreach ($recommend_goods_list as $k => $v) {
             $goods_list = $model_goods->getGeneralGoodsOnlineList(array('gc_id_1' => $v['gc_id']), 'goods_id,goods_name,goods_price,goods_promotion_price,goods_promotion_type,distribution_price,goods_storage,goods_marketprice,goods_image', 6, 'goods_salenum desc');
             if ($goods_list) {
                 foreach ($goods_list as $kk => $vv) {
                     if ($vv['goods_promotion_type'] > 0) {
                         $goods_list[$kk]['goods_price'] = $vv['goods_promotion_price'];
                     } elseif ($vv['distribution_price'] > 0) {
                         $goods_list[$kk]['goods_price'] = $vv['distribution_price'];
                     }
                     $goods_list[$kk]['img_url'] = thumb($vv, 360);
                     $goods_list[$kk]['discount'] = sprintf('%0.1f', $goods_list[$kk]['goods_price'] / $vv['goods_marketprice'] * 10);
                 }
                 $recommend_goods_list[$k]['list'] = $goods_list;
             } else {
                 unset($recommend_goods_list[$k]);
             }
         }
     }
     output_data(array('recommend_goods_list' => $recommend_goods_list));
 }
开发者ID:sdjncjc,项目名称:meizhan,代码行数:28,代码来源:mz_index.php


示例2: mkthumb

 /**
  * Make thumbnail
  *
  * Usage:
  * {pyro:getpost:mkthumb src="/uploads/file/file.jpg" w="200" h="200"}
  *
  * @param	int
  * @return	string
  */
 function mkthumb()
 {
     $file = $this->attribute('src', 'String');
     $w = $this->attribute('w', 'Number');
     $h = $this->attribute('h', 'Number');
     return thumb(site_url() . $file, $w, $h);
 }
开发者ID:phonglanpls,项目名称:jz-proj-2012,代码行数:16,代码来源:getpost.php


示例3: getListOp

 /**
  * 获取收藏列表
  * @return [type] [description]
  */
 public function getListOp()
 {
     $fav_type = $_GET["fav_type"];
     $size = 10;
     $page = intval($_GET['page']);
     $page = $page <= 0 ? 1 : $page;
     if (!in_array($fav_type, array('goods', 'store'))) {
         output_error("未知收藏类型");
     }
     $favorites_model = Model('favorites');
     $condition = array();
     $condition['member_id'] = $this->member_info['member_id'];
     $condition['fav_type'] = $fav_type;
     $favorites_list = $favorites_model->getFavoritesList($condition, "*", true, 'log_id desc', ($page - 1) * $size . ',' . $size);
     if (!empty($favorites_list)) {
         foreach ($favorites_list as $key => $value) {
             if ($fav_type == 'goods') {
                 $extends_goods = Model('goods')->getGoodsInfo(array('goods_id' => $value['fav_id']), '*');
                 $favorites_list[$key]['goods_img'] = thumb($extends_goods, 360);
                 $favorites_list[$key]['goods_state'] = $extends_goods['goods_state'];
                 $favorites_list[$key]['is_presell'] = $extends_goods['is_presell'];
                 $favorites_list[$key]['goods_type'] = $extends_goods['goods_type'];
                 $favorites_list[$key]['goods_price'] = $extends_goods['goods_price'];
                 $favorites_list[$key]['goods_marketprice'] = $extends_goods['goods_marketprice'];
                 $favorites_list[$key]['goods_discount'] = round($extends_goods['goods_price'] / $extends_goods['goods_marketprice'] * 10, 1);
             }
         }
     }
     $fav_count = Model()->table('favorites')->where($condition)->count();
     $data_info = array();
     $data_info['thispage'] = $page;
     $data_info['totalpage'] = ceil($fav_count / $size);
     output_data(array('data' => $favorites_list, 'data_info' => $data_info));
 }
开发者ID:noikiy,项目名称:meizhan,代码行数:38,代码来源:mz_member_favorites.php


示例4: init

	public function init() {
		$siteurl = siteurl(SITEID);
		if(empty($this->rssid)) {
			$catid = $_GET['catid'] ? intval($_GET['catid']) : '0';
			$siteids = getcache('category_content','commons');
			$siteid = $siteids[$catid] ? $siteids[$catid] : 1;
			$CATEGORYS = getcache('category_content_'.$siteid,'commons');
			$subcats = subcat($catid,0,1,$siteid);
			foreach ($CATEGORYS as $r) if($r['parentid'] == 0) $channel[] = $r;
			include template('content','rss');
		} else {
			$CATEGORYS = getcache('category_content_'.$this->siteid,'commons');
			$SITEINFO = getcache('sitelist','commons');
			$CAT = $CATEGORYS[$this->rssid];
			if(count($CAT) == 0) showmessage(L('missing_part_parameters'),'blank');
			$siteid = $CAT['siteid'];
			$sitedomain = $SITEINFO[$siteid]['domain'];  //获取站点域名
			$MODEL = getcache('model','commons');
			$modelid = $CAT['modelid'];		
		    $encoding   =  CHARSET;
		    $about      =  SITE_PROTOCOL.SITE_URL;
		    $title      =  $CAT['catname'];
		    $description = $CAT['description'];
		    $content_html = $CAT['content_ishtml'];
		    $image_link =  "<![CDATA[".$CAT['image']."]]> ";
		    $category   =  '';
		    $cache      =  60;
		    $rssfile    = new RSSBuilder($encoding, $about, $title, $description, $image_link, $category, $cache);
		    $publisher  =  '';
		    $creator    =  SITE_PROTOCOL.SITE_URL;
		    $date       =  date('r');
		    $rssfile->addDCdata($publisher, $creator, $date);
		    $ids = explode(",",$CAT['arrchildid']);
		    if(count($ids) == 1 && in_array($this->rssid, $ids)) {
		        $sql .= "`catid` = '$this->rssid' AND `status` = '99'";
		    } else {
		        $sql .= get_sql_catid('category_content_'.$siteid,$this->rssid)." AND `status` = '99'";
		    }
			if(empty($MODEL[$modelid]['tablename'])) showmessage(L('missing_part_parameters'),'blank');
		    $this->db->table_name = $this->db->db_tablepre.$MODEL[$modelid]['tablename'];
			$info = $this->db->select($sql,'`title`, `description`, `url`, `inputtime`, `thumb`, `keywords`','0,20','id DESC');
		
			foreach ($info as $r) {
			    //添加项目
			    if(!empty($r['thumb'])) $img = "<img src=".thumb($r['thumb'], 150, 150)." border='0' /><br />";else $img = '';
		        $about          =  $link = (strpos($r['url'], 'http://') !== FALSE || strpos($r['url'], 'https://') !== FALSE) ? "<![CDATA[".$r['url']."]]> " : (($content_html == 1) ? "<![CDATA[".substr($sitedomain,0,-1).$r['url']."]]> " : "<![CDATA[".substr(APP_PATH,0,-1).$r['url']."]]> ");
		        $title          =   "<![CDATA[".$r['title']."]]> ";
		        $description    =  "<![CDATA[".$img.$r['description']."]]> ";
		        $subject        =  '';
		        $date           =  date('Y-m-d H:i:s' , $r['inputtime']);
		        $author         =  $ZLCMS['sitename'].' '.SITE_PROTOCOL.SITE_URL;
		        $comments       =  '';//注释;
	
		        $rssfile->addItem($about, $title, $link, $description, $subject, $date,	$author, $comments, $image);
			}	
			$version = '2.00';
	    	$rssfile->outputRSS($version);
		}    	        	
	}
开发者ID:panhongsheng,项目名称:zl_cms,代码行数:59,代码来源:rss.php


示例5: bundling_listOp

 /**
  * 发布的活动列表
  */
 public function bundling_listOp()
 {
     $model_bundling = Model('p_bundling');
     // 更新套装状态
     $where = array();
     $where['store_id'] = $_SESSION['store_id'];
     $where['bl_quota_endtime'] = array('lt', TIMESTAMP);
     $model_bundling->editBundlingQuotaClose($where);
     // 检查是否已购买套餐
     $where = array();
     $where['store_id'] = $_SESSION['store_id'];
     $bundling_quota = $model_bundling->getBundlingQuotaInfo($where);
     Tpl::output('bundling_quota', $bundling_quota);
     if (!empty($bundling_quota)) {
         // 计算已经发布活动、剩余活动数量
         $bundling_published = $model_bundling->getBundlingCount(array('store_id' => $_SESSION['store_id']));
         $bundling_surplus = intval(C('promotion_bundling_sum')) - intval($bundling_published);
         Tpl::output('bundling_published', $bundling_published);
         Tpl::output('bundling_surplus', $bundling_surplus);
         // 查询活动
         $where = array();
         $where['store_id'] = $_SESSION['store_id'];
         if ($_GET['bundling_name'] != '') {
             $where['bl_name'] = array('like', '%' . trim($_GET['bundling_name']) . '%');
         }
         if (is_numeric($_GET['state'])) {
             $where['bl_state'] = $_GET['state'];
         }
         $bundling_list = $model_bundling->getBundlingList($where, '*', 'bl_id desc', 10, 0, $bundling_published);
         $bundling_list = array_under_reset($bundling_list, 'bl_id');
         Tpl::output('show_page', $model_bundling->showpage(2));
         if (!empty($bundling_list)) {
             $blid_array = array_keys($bundling_list);
             $bgoods_array = $model_bundling->getBundlingGoodsList(array('bl_id' => array('in', $blid_array), 'bl_appoint' => 1), 'bl_id,goods_id,count(*) as count', 'bl_appoint desc', 'bl_id');
             $bgoods_array = array_under_reset($bgoods_array, 'goods_id');
             if (!empty($bgoods_array)) {
                 $goodsid_array = array_keys($bgoods_array);
                 $goods_array = Model('goods')->getGoodsList(array('goods_id' => array('in', $goodsid_array)), 'goods_id,goods_image');
                 $goods_array = array_under_reset($goods_array, 'goods_id');
             }
             $bgoods_array = array_under_reset($bgoods_array, 'bl_id');
             foreach ($bundling_list as $key => $val) {
                 $bundling_list[$key]['goods_id'] = $bgoods_array[$val['bl_id']]['goods_id'];
                 $bundling_list[$key]['count'] = $bgoods_array[$val['bl_id']]['count'];
                 $bundling_list[$key]['img'] = thumb($goods_array[$bgoods_array[$val['bl_id']]['goods_id']], 60);
             }
         }
         Tpl::output('list', $bundling_list);
         // 状态数组
         $state_array = array(0 => Language::get('bundling_status_0'), 1 => Language::get('bundling_status_1'));
         Tpl::output('state_array', $state_array);
     }
     $this->profile_menu('bundling_list', 'bundling_list');
     Tpl::showpage('store_promotion_bundling.list');
 }
开发者ID:Maplecms,项目名称:shopnc-yhmall,代码行数:58,代码来源:store_promotion_bundling.php


示例6: view

function view($group)
{
    global $url, $home;
    requirelogin();
    $group = protect($group);
    $group = resolvegroup($group);
    $owner = mysql_query("SELECT `login` FROM accounts WHERE `id`='{$group['owner']}'");
    $owner = mysql_fetch_array($owner);
    $owner = $owner['login'];
    $output = '<h3>' . $group['title'] . '</h3>
<p>' . bbcode($group['desc']) . '<hr size="1">
<b>' . t("Criado por") . '</b> ' . url("user/profile/{$owner}", $owner) . '</p>';
    section($output, t("Grupo"));
    $members = null;
    if (estounogrupo($group['id'])) {
        $members .= url("groups/participacao/{$group['url']}", t("[sair do grupo]")) . '<br>';
    } else {
        $members .= url("groups/participacao/{$group['url']}", t("[participar]")) . '<br>';
    }
    $qry = mysql_query("SELECT a.login AS l, a.foto AS f FROM groups_join g LEFT JOIN accounts a ON g.account=a.id WHERE g.group='{$group['id']}' LIMIT 100");
    if (mysql_numrows($qry) != 0) {
        while ($row = mysql_fetch_array($qry)) {
            $members .= '<div class="row"><p>
                  ' . url("user/profile/{$row['l']}", '<img src="' . $url . '/upload/' . thumb($row[f]) . '">') . '<br>
                  ' . url("user/profile/{$row['l']}", $row[l]) . '
                  </p></div>';
        }
    } else {
        $members .= t("Não há membros.");
    }
    section($members, t("Membros"));
    if (estounogrupo($group['id'])) {
        // show shoutbox
        $output = '<form method="post" action="' . $home . 'groups/writesbpost">
                <input type="hidden" name="group" value="' . $group['id'] . '">
                <label for="content">Escrever</label><br/>
                <textarea name="content" id="content" rows="5" cols="25"></textarea>
                <br/><input type="submit" value="' . t("Enviar") . '"></form><br/>';
        $qry = mysql_query("SELECT * FROM groups_shoutbox WHERE `id_group`='{$group['id']}' ORDER BY id DESC LIMIT 30");
        if (mysql_numrows($qry) == 0) {
            $output .= infobox(t("Não há itens na shoutbox deste grupo."), false);
        } else {
            while ($row = mysql_fetch_array($qry)) {
                $user = mysql_fetch_array(mysql_query("SELECT login FROM accounts WHERE `id`='{$row['owner']}'"));
                $output .= '<p>
                    ' . url("user/profile/{$user['login']}", $user['login']) . ': ' . bbcode($row['text']);
                if ($group['owner'] == $_SESSION['id'] or $row['owner'] == $_SESSION['id'] or is_admin()) {
                    $output .= '<br/>' . url("groups/remsb/{$row['id']}", t("[remover]"));
                }
                $output .= '</p><hr size="1">';
            }
        }
        section($output, t("Shoutbox do grupo"));
    }
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:55,代码来源:groups.php


示例7: __construct

 public function __construct($image, $args = array())
 {
     $this->image = $image;
     $this->thumb = thumb($image, $args);
     $this->to_path = $this->thumb()->dir() . '/' . $this->toFilename();
     $this->to_name = $this->removeExtension();
     $this->to_url = $this->toUrl();
     if (!file_exists($this->to_path)) {
         $this->compressImage();
     }
 }
开发者ID:jenstornell,项目名称:Kirby-tinyThumb,代码行数:11,代码来源:tiny-thumb.php


示例8: bgimage

/**
 * imgsrc Plugin
 *
 * @author Marijn Tijhuis <[email protected]>
 * @author Jonathan van Wunnik <[email protected]>
 * @version 1.0.0
 */
function bgimage($image = false, $options = array())
{
    if (!$image) {
        return;
    }
    // Default key values
    $defaults = array('width' => null, 'height' => null, 'crop' => null, 'cropratio' => null, 'class' => '', 'alt' => '', 'quality' => c::get('thumbs.quality', 92), 'lazyload' => c::get('lazyload', false));
    // Merge defaults and options
    $options = array_merge($defaults, $options);
    // Without resrc, maximize thumb width, for speedier loading of page!
    if (c::get('resrc') == false) {
        if (!isset($options['width'])) {
            $thumbwidth = c::get('thumbs.width.default', 800);
        } else {
            $thumbwidth = $options['width'];
        }
    } else {
        // If resrc is enabled, use original image width
        $thumbwidth = $image->width();
    }
    // If no crop variable is defined *and* no cropratio
    // is set, the crop variable is set to false
    if (!isset($options['crop']) && !isset($options['cropratio'])) {
        $options['crop'] = false;
    }
    // When a cropratio is set, calculate the ratio based height
    if (isset($options['cropratio'])) {
        // If cropratio is a fraction string (e.g. 1/2), convert to decimal
        if (strpos($options['cropratio'], '/') !== false) {
            list($numerator, $denominator) = str::split($options['cropratio'], '/');
            $options['cropratio'] = $numerator / $denominator;
        }
        // Calculate new thumb height based on cropratio
        $thumbheight = round($thumbwidth * $options['cropratio']);
        // If a cropratio is set, the crop variable is always set to true
        $options['crop'] = true;
        // Manual set (crop)ratio
        $ratio = $options['cropratio'];
    } else {
        // Intrinsic image's ratio
        $ratio = 1 / $image->ratio();
        // Max. height of image
        $thumbheight = round($thumbwidth * $ratio);
    }
    // Create thumb url (create a new thumb object)
    $options['thumburl'] = thumb($image, array('width' => $thumbwidth, 'height' => $thumbheight, 'quality' => $options['quality'], 'crop' => $options['crop']), false);
    // Add more values to options array, for use in template
    $options['customwidth'] = $options['width'];
    $options['customquality'] = $options['quality'];
    $options['ratio'] = $ratio;
    // Return template HTML
    return tpl::load(__DIR__ . DS . 'template/bgimage.php', $options);
}
开发者ID:veryrobert,项目名称:altair,代码行数:60,代码来源:bgimage.php


示例9: cover_img

 public function cover_img($as = false)
 {
     $cover_img = $this->files()->find($this->cover());
     if ($cover_img) {
         if ($as) {
             $cover_thumb = thumb($cover_img, array("width" => 400, "height" => 250, "blur" => true));
             return brick('div')->attr('style', "background-image:url(" . $cover_thumb->url() . ");")->addClass('story__cover');
         }
         return $cover_img->url();
     }
     return false;
 }
开发者ID:rafegoldberg,项目名称:zazu,代码行数:12,代码来源:project.php


示例10: modules

function modules()
{
    global $url;
    $output = '<p>' . url("comu/newmodule", "Novo módulo") . '</p>';
    $qry = mysql_query("SELECT * FROM comunidade WHERE tipo='m' ORDER BY id DESC");
    while ($row = mysql_fetch_array($qry)) {
        $output .= '<p class="row">';
        $output .= url("comu/viewtheme/{$row['id']}", $row['nome']);
        $output .= '<img src="' . $url . '/upload/' . thumb($row['imagem']) . '" width="100">';
        $output .= '</p>';
    }
    section($output, 'Módulos');
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:13,代码来源:comu.php


示例11: getLists

 /**
  * 获取收藏列表
  * @param  int $uid 用户uid
  */
 public function getLists($uid)
 {
     $map = array('user_id' => $uid);
     $lists = $this->where($map)->select();
     $product = array();
     foreach ($lists as $key => $value) {
         $product = M('FxProduct')->field('product_name, thumb')->where(array('product_id' => $value['product']))->find();
         $lists[$key]['title'] = msubstr($product['product_name'], 0, 15);
         $lists[$key]['thumb'] = thumb($product['thumb']);
         $lists[$key]['url'] = U('Index/product', array('id' => $value['product']));
         $lists[$key]['del_url'] = U('collect', array('type' => 2, 'product_id' => $value['product']));
     }
     return $lists;
 }
开发者ID:wuwenbao,项目名称:paimai,代码行数:18,代码来源:FxProductCollectModel.class.php


示例12: editHouse

/**
 *�༭��Ʒ
 * @param int $id
 * @return string
 */
function editHouse($id)
{
    $arr = $_POST;
    $arr['update_time'] = date("Y-m-d H:i:s");
    $sql = "select house_id from tg_host_house where id={$id}";
    $row = fetchOne($sql);
    //��house_id������album_id
    $album_id = $row['house_id'];
    $path = "../uploads/House_Album/user_id_" . $album_id;
    //����û�жϾ��ϴ�ͼƬ���ļ��У�ͼƬ��ݲ�һ���ɹ�������ݿ�
    $uploadFiles = uploadFile($path);
    if (is_array($uploadFiles) && $uploadFiles) {
        foreach ($uploadFiles as $key => $uploadFile) {
            thumb($path . "/" . $uploadFile['name'], "../image_50/user_id_" . $album_id . "/" . $uploadFile['name'], 50, 50);
        }
    }
    //����host_house�����
    $where = "house_id={$id}";
    $res = update("tg_host_house", $arr, $where);
    //ע�⣺����ֻ�ܸ�����ݱ������е��ֶΣ����post�����ݸ�table����ֶβ�ƥ�䣬����ʧ�ܣ�����
    $house_id = $row['house_id'];
    //����ȡ�� house_id ����Ӧ album_id
    $sql_img = "select i.album_id from tg_house_img as i left join tg_host_house h on h.house_id=i.album_id where i.album_id={$house_id}";
    $row_img = fetchOne($sql_img);
    //��img_path ��ӵ� tg_house_img��
    if ($res && $house_id) {
        if ($uploadFiles && is_array($uploadFiles)) {
            foreach ($uploadFiles as $uploadFile) {
                $arr1['album_id'] = $house_id;
                $arr1['img_path'] = $uploadFile['name'];
                //print_r($arr1['img_path']);exit;
                addAlbum($arr1);
            }
        }
        $mes = "<p>Edit success!</p><a href='listHouse.php' target='mainFrame'>View house list</a>";
    } else {
        if (is_array($uploadFiles) && $uploadFiles) {
            foreach ($uploadFiles as $uploadFile) {
                if (file_exists("../image_50/user_id_" . $_SESSION['user_id'] . "/" . $uploadFile['name'])) {
                    unlink("../image_50/user_id_" . $_SESSION['user_id'] . "/" . $uploadFile['name']);
                }
                if (file_exists("../uploads/House_Album/user_id_" . $_SESSION['user_id'] . "/" . $uploadFile['name'])) {
                    unlink("../uploads/House_Album/user_id_" . $_SESSION['user_id'] . "/" . $uploadFile['name']);
                }
            }
        }
        $mes = "<p>Failed!</p><a href='listHouse.php' target='mainFrame'>Edit again</a>";
    }
    return $mes;
}
开发者ID:win87,项目名称:homarget2,代码行数:55,代码来源:house.inc.php


示例13: picture

 public function picture($imageFile, $ruleSet, $options, $attributes)
 {
     $markup = '';
     foreach ($ruleSet as $rule) {
         $id = 'img' . random();
         if ($rule['mediaRule']) {
             echo "\n              <style scoped>\n                #" . $id . " { display: none; }\n\n                @media only screen and " . $rule['mediaRule'] . " {\n                  #" . $id . " { display: block; }\n                }\n              </style>\n            ";
         }
         echo '<img
         id="' . $id . '"
         src="' . $imageFile . thumb($rule . dimensions[0], $rule . dimensions[1], $options) . '" ' . $attributes . '>';
     }
     return $markup;
 }
开发者ID:fuunnx,项目名称:loveandzucchini,代码行数:14,代码来源:Markup.php


示例14: figure

/**
 * Figure Plugin
 *
 * @author Marijn Tijhuis <[email protected]>
 * @author Jonathan van Wunnik <[email protected]>
 * @version 1.0.0
 */
function figure($image = false, $options = array())
{
    if (!$image) {
        return;
    }
    // default key values
    $defaults = array('crop' => null, 'cropratio' => null, 'class' => '', 'alt' => '', 'caption' => null, 'lazyload' => c::get('lazyload', false));
    // merge defaults and options
    $options = array_merge($defaults, $options);
    // without resrc, maximize thumb width, for speedier loading of page!
    if (c::get('resrc') == false) {
        $thumbwidth = c::get('thumb.dev.width', 800);
    } else {
        // with resrc use maximum (original) image width
        $thumbwidth = null;
    }
    // if no crop variable is defined *and* no cropratio
    // is set, the crop variable is set to false
    if (!isset($options['crop']) && !isset($options['cropratio'])) {
        $options['crop'] = false;
    }
    // when a cropratio is set, calculate the ratio based height
    if (isset($options['cropratio'])) {
        // if resrc is enabled (and therefor $thumbwidth is not set (e.g. `null`),
        // to use max width of image!), set thumbwidth to width of original image
        if (!isset($thumbwidth)) {
            $thumbwidth = $image->width();
        }
        // if cropratio is a fraction string (e.g. 1/2), convert to decimal
        // if(!is_numeric($options['cropratio'])) {
        if (strpos($options['cropratio'], '/') !== false) {
            list($numerator, $denominator) = str::split($options['cropratio'], '/');
            $options['cropratio'] = $numerator / $denominator;
        }
        // calculate new thumb height based on cropratio
        $thumbheight = round($thumbwidth * $options['cropratio']);
        // if a cropratio is set, the crop variable is always set to true
        $options['crop'] = true;
    } else {
        $thumbheight = null;
        // max height of image
    }
    // Create thumb url (create a new thumb object)
    $options['thumburl'] = thumb($image, array('width' => $thumbwidth, 'height' => $thumbheight, 'crop' => $options['crop']), false);
    // Add image object to options array, for use in template
    $options['image'] = $image;
    // Return template HTML
    return tpl::load(__DIR__ . DS . 'template.php', $options);
}
开发者ID:igorqr,项目名称:kirby-extensions,代码行数:56,代码来源:figure.php


示例15: test_thumb

 public function test_thumb($param)
 {
     $url = $this->input->get("url");
     $w = (int) $this->input->get("w");
     $h = (int) $this->input->get("h");
     // echo $url;
     echo "<br>";
     $th = thumb($url, $w, $h);
     echo $th . "<hr>";
     echo "<img src='{$th}' />";
     echo "<hr/><pre>" . __FILE__ . " L:" . __LINE__;
     var_dump($th);
     echo "</pre><hr/>";
     die;
 }
开发者ID:rino7,项目名称:ci_media_manager,代码行数:15,代码来源:MM_archivos.php


示例16: indexOp

	public function indexOp(){
        $model_mb_ad = Model('mb_ad');
        $model_mb_home = Model('mb_home');

        $datas = array();

        //广告
        $adv_list = array();
        $mb_ad_list = $model_mb_ad->getMbAdList(array(), null, 'link_sort asc');
        foreach ($mb_ad_list as $value) {
            $adv = array();
            $adv['image'] = $value['link_pic_url'];
            $adv['keyword'] = $value['link_keyword'];
            $adv_list[] = $adv;
        }
        

        //首页
        $home_type1_list = array();
        $home_type2_list = array();
        //$mb_home_list = $model_mb_home->getMbHomeList(array(), null, 'h_sort asc');

        // @tsh
        $advList=array();
        $list=Model('adv')->getList(array('ap_id'=>373));
        foreach($list as $v){
            $advContent=unserialize($v['adv_content']);
            $advContent['keyword']=$v['adv_title'];
            $advContent['image']=UPLOAD_SITE_URL.'/shop/adv/'.$advContent['adv_pic'];
            $advList[]=$advContent;
        }
        $datas['adv_list'] = $advList;

        $mb_home_list=Model('goods')->select();
        foreach ($mb_home_list as $value) {
            $home = array();
            $home['image'] = thumb($value,160);
            $home['title'] = $value['goods_name'];
            $home['desc'] = $value['goods_jingle'];
            $home['keyword1'] = '';
            $home_type1_list[] = $home;
        }

        $datas['home1'] = $home_type1_list;
        $datas['home2'] = $home_type1_list;

        output_data($datas);
	}
开发者ID:noikiy,项目名称:travel,代码行数:48,代码来源:index.php


示例17: section

 public function section($id = 0)
 {
     $id = round($id);
     $info = $this->data['info'] = $this->Data->Information($id);
     if (!$this->data['info']) {
         return $this->error();
     }
     $headers['head-title'] = $info->title . ' | ' . $this->config->item('client', 'app');
     $headers['title'] = $info->title;
     $headers['description'] = $headers['keywords'] = strip_tags($info->text);
     if ($info->file) {
         $headers['og:image'] = thumb($info->file, 650, 498);
     }
     $this->data['headers'] = $headers;
     $this->load->view('section/static', $this->data);
 }
开发者ID:juanazareno,项目名称:joan-cornella,代码行数:16,代码来源:app.php


示例18: autothumbhook

function autothumbhook($file)
{
    if (!c::get('autothumb.enabled', false) || !$file->isImage()) {
        return;
    }
    try {
        $height = c::get('autothumb.height', 500);
        $quality = c::get('autothumb.quality', 70);
        $dimensions = clone $file->dimensions();
        $dimensions->fitHeight($height);
        $thumb = thumb($file, ['width' => $dimensions->width(), 'height' => $dimensions->height(), 'quality' => $quality]);
        echo $thumb->root();
    } catch (Exception $e) {
        return response::error($e->getMessage());
    }
}
开发者ID:lyoshenka,项目名称:travelblog,代码行数:16,代码来源:autothumb.php


示例19: ajax_loadOp

 /**
  * 异步查询购物车
  */
 public function ajax_loadOp()
 {
     $model_cart = Model('cart');
     if ($_SESSION['member_id']) {
         //登录后
         $cart_list = $model_cart->listCart('db', array('buyer_id' => $_SESSION['member_id']));
         $cart_array = array();
         if (!empty($cart_list)) {
             foreach ($cart_list as $k => $cart) {
                 $cart_array['list'][$k]['cart_id'] = $cart['cart_id'];
                 $cart_array['list'][$k]['goods_id'] = $cart['goods_id'];
                 $cart_array['list'][$k]['goods_name'] = $cart['goods_name'];
                 $cart_array['list'][$k]['goods_price'] = $cart['goods_price'];
                 $cart_array['list'][$k]['goods_image'] = thumb($cart, 60);
                 $cart_array['list'][$k]['goods_num'] = $cart['goods_num'];
                 $cart_array['list'][$k]['goods_url'] = urlShop('goods', 'index', array('goods_id' => $cart['goods_id']));
             }
         }
     } else {
         //登录前
         $cart_list = $model_cart->listCart('cookie');
         foreach ($cart_list as $key => $cart) {
             $value = array();
             $value['cart_id'] = $cart['goods_id'];
             $value['goods_name'] = $cart['goods_name'];
             $value['goods_price'] = $cart['goods_price'];
             $value['goods_num'] = $cart['goods_num'];
             $value['goods_image'] = thumb($cart, 60);
             $value['goods_url'] = urlShop('goods', 'index', array('goods_id' => $cart['goods_id']));
             $cart_array['list'][] = $value;
         }
     }
     setNcCookie('cart_goods_num', $model_cart->cart_goods_num, 2 * 3600);
     $cart_array['cart_all_price'] = ncPriceFormat($model_cart->cart_all_price);
     $cart_array['cart_goods_num'] = $model_cart->cart_goods_num;
     if ($_GET['type'] == 'html') {
         Tpl::output('cart_list', $cart_array);
         Tpl::showpage('cart_mini', 'null_layout');
     } else {
         $cart_array = strtoupper(CHARSET) == 'GBK' ? Language::getUTF8($cart_array) : $cart_array;
         $json_data = json_encode($cart_array);
         if (isset($_GET['callback'])) {
             $json_data = $_GET['callback'] == '?' ? '(' . $json_data . ')' : $_GET['callback'] . "({$json_data});";
         }
         exit($json_data);
     }
 }
开发者ID:xuxuecheng,项目名称:shopnc,代码行数:50,代码来源:cart.php


示例20: editPro

/**
 *编辑商品
 * @param int $id
 * @return string
 */
function editPro($id)
{
    $arr = $_POST;
    $path = "./uploads";
    $uploadFiles = uploadFile($path);
    if (is_array($uploadFiles) && $uploadFiles) {
        foreach ($uploadFiles as $key => $uploadFile) {
            thumb($path . "/" . $uploadFile['name'], "../image_50/" . $uploadFile['name'], 50, 50);
            thumb($path . "/" . $uploadFile['name'], "../image_220/" . $uploadFile['name'], 220, 220);
            thumb($path . "/" . $uploadFile['name'], "../image_350/" . $uploadFile['name'], 350, 350);
            thumb($path . "/" . $uploadFile['name'], "../image_800/" . $uploadFile['name'], 800, 800);
        }
    }
    $where = "id={$id}";
    $res = update("imooc_pro", $arr, $where);
    $pid = $id;
    if ($res && $pid) {
        //判断是否有图片上传
        if ($uploadFiles && is_array($uploadFiles)) {
            foreach ($uploadFiles as $uploadFile) {
                $arr1['pid'] = $pid;
                $arr1['albumPath'] = $uploadFile['name'];
                addAlbum($arr1);
            }
        }
        $mes = "<p>编辑成功!</p><a href='listPro.php' target='mainFrame'>查看商品列表</a>";
    } else {
        if (is_array($uploadFiles) && $uploadFiles) {
            foreach ($uploadFiles as $uploadFile) {
                if (file_exists("../image_800/" . $uploadFile['name'])) {
                    unlink("../image_800/" . $uploadFile['name']);
                }
                if (file_exists("../image_50/" . $uploadFile['name'])) {
                    unlink("../image_50/" . $uploadFile['name']);
                }
                if (file_exists("../image_220/" . $uploadFile['name'])) {
                    unlink("../image_220/" . $uploadFile['name']);
                }
                if (file_exists("../image_350/" . $uploadFile['name'])) {
                    unlink("../image_350/" . $uploadFile['name']);
                }
            }
        }
        $mes = "<p>编辑失败!</p><a href='listPro.php' target='mainFrame'>重新编辑</a>";
    }
    return $mes;
}
开发者ID:juststart2015,项目名称:Electronic-commerce-system,代码行数:52,代码来源:pro.inc.php



注:本文中的thumb函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP thumb_url函数代码示例发布时间:2022-05-23
下一篇:
PHP throw_the_bum_out函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap