本文整理汇总了PHP中thumb函数的典型用法代码示例。如果您正苦于以下问题:PHP thumb函数的具体用法?PHP thumb怎么用?PHP thumb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了thumb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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);
}
示例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));
}
示例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);
}
}
示例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');
}
示例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"));
}
}
示例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();
}
}
示例8: bgimage
/**
* imgsrc Plugin
*
* @author Marijn Tijhuis <marijn@studiodumbar.com>
* @author Jonathan van Wunnik <jonathan@studiodumbar.com.com>
* @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);
}
示例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;
}
示例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');
}
示例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;
}
示例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;
}
示例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;
}
示例14: figure
/**
* Figure Plugin
*
* @author Marijn Tijhuis <marijn@studiodumbar.com>
* @author Jonathan van Wunnik <jonathan@studiodumbar.com.com>
* @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);
}
示例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;
}