本文整理汇总了PHP中Skin::build_image方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::build_image方法的具体用法?PHP Skin::build_image怎么用?PHP Skin::build_image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::build_image方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: layout
/**
* list sections
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return some text
$text = '';
// process all items in the list
while ($item = SQL::fetch($result)) {
// we want to make it visual
if (!$item['thumbnail_url']) {
continue;
}
// a title for the image --do not force a title
if (isset($item['title'])) {
$title = $item['title'];
} else {
$title = '';
}
// the url to view this item
$url = Sections::get_permalink($item);
// use the skin to shape it
$text .= Skin::build_image('thumbnail', $item['thumbnail_url'], $title, $url);
}
// end of processing
SQL::free($result);
return $text;
}
示例2: layout
/**
* list images
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return html text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
$variant = 'thumbnail';
// process all items in the list
while ($image = SQL::fetch($result)) {
// a title for the image --do not force a title
if (isset($image['title'])) {
$title = $image['title'];
} else {
$title = '';
}
// provide thumbnail if not defined, or forced, or for large images
if (!$image['use_thumbnail'] || $image['use_thumbnail'] == 'A' || $image['use_thumbnail'] == 'Y' && $image['image_size'] > $context['thumbnail_threshold']) {
// where to fetch the image file
$href = Images::get_thumbnail_href($image);
// to drive to plain image
$link = Images::get_icon_href($image);
// add an url, if any
} elseif ($image['link_url']) {
// flag large images
if ($image['image_size'] > $context['thumbnail_threshold']) {
$variant = rtrim('large ' . $variant);
}
// where to fetch the image file
$href = Images::get_icon_href($image);
// transform local references, if any
include_once $context['path_to_root'] . '/links/links.php';
$attributes = Links::transform_reference($image['link_url']);
if ($attributes[0]) {
$link = $context['url_to_root'] . $attributes[0];
} else {
$link = $image['link_url'];
}
// get the <img ... /> element
} else {
// do not append poor titles to inline images
if ($variant == 'thumbnail') {
$title = '';
}
// flag large images
if ($image['image_size'] > $context['thumbnail_threshold']) {
$variant = rtrim('large ' . $variant);
}
// where to fetch the image file
$href = Images::get_icon_href($image);
// no link
$link = '';
}
// use the skin
if (Images::allow_modification($image['anchor'], $image['id'])) {
// build editable image
$text .= Skin::build_image($variant, $href, $title, $link, $image['id']);
} else {
$text .= Skin::build_image($variant, $href, $title, $link);
}
}
// end of processing
SQL::free($result);
return $text;
}
示例3: preview
/**
* give a preview of file rendering
* used after ajax uploading in forms
*
* @param string $url string where is the file
* @param string $input_name the input that what used to upload
*/
public static function preview($url, $input_name)
{
global $context;
// get file ext.
$ext = pathinfo($url, PATHINFO_EXTENSION);
$basename = basename($url);
// at least show file's name
$preview = $basename;
// destroy link, put it where you want
$destroy = '<a class="yc-upload-destroy" data-del="' . $input_name . '" href="javascript:void(0);" title="' . i18n::s('Delete') . '" onclick="Yacs.uploadDestroy($(this).data(\'del\'),$(this))" >x</a>' . "\n";
// file is a image
if (Files::is_image($url) && ($image_information = Safe::GetImageSize($url))) {
// make a temp thumb name
$thumb = uniqid() . '.' . $ext;
$thumbpath = $context['path_to_root'] . UPLOAD_PATH . $thumb;
$thumburl = $context['url_to_root'] . UPLOAD_PATH . $thumb;
// make a thumb
Image::shrink($url, $thumbpath, true);
// build image
$preview = Skin::build_image('left', $thumburl, '') . '<span style="line-height:34px"> ' . $basename . '</span>' . "\n" . $destroy;
} else {
// file is a reconnized audio format
switch ($ext) {
case 'mp3':
case 'm4a':
case 'aac':
case 'oog':
// audio file
$audio_url = $context['url_to_root'] . UPLOAD_PATH . $basename;
$preview .= $destroy . BR . Skin::build_audioplayer($audio_url);
break;
default:
$icon = Skin::build_image('inline', $context['url_to_master'] . $context['url_to_root'] . Files::get_icon_url($basename), $basename);
$preview = $icon . $preview . ' ' . $destroy;
break;
}
}
// add separator
$preview .= '<hr class="clear" />' . "\n";
// wrap
$preview = '<div class="yc-preview">' . $preview . '</div>';
return $preview;
}
示例4: render_object
//.........这里部分代码省略.........
} elseif ($image['link_url']) {
// flag large images
if ($image['image_size'] > $context['thumbnail_threshold']) {
$variant = rtrim('large ' . $variant);
}
// where to fetch the image file
$href = Images::get_icon_href($image);
// transform local references, if any
include_once $context['path_to_root'] . '/links/links.php';
$attributes = Links::transform_reference($image['link_url']);
if ($attributes[0]) {
$link = $context['url_to_root'] . $attributes[0];
} else {
$link = $image['link_url'];
}
// get the <img ... /> element
} else {
// do not append poor titles to inline images
if ($variant == 'inline') {
$title = '';
}
// flag large images
if ($image['image_size'] > $context['thumbnail_threshold']) {
$variant = rtrim('large ' . $variant);
}
// where to fetch the image file
$href = Images::get_icon_href($image);
// no link
$link = '';
}
// use the skin
if (Images::allow_modification($image['anchor'], $id)) {
// build editable image
$output =& Skin::build_image($variant, $href, $title, $link, $id);
} else {
$output =& Skin::build_image($variant, $href, $title, $link);
}
return $output;
// embed a stack of images
// embed a stack of images
case 'images':
include_once $context['path_to_root'] . 'images/images.php';
// get the list of ids
$ids = preg_split("/\\s*,\\s*/", $id);
if (!count($ids)) {
$output = '[images=id1, id2, ...]';
return $output;
}
// build the list of images
$items = array();
foreach ($ids as $id) {
// get the image record
if ($image = Images::get($id)) {
// a title for the image --do not force a title
if (isset($image['title'])) {
$title = $image['title'];
} else {
$title = '';
}
// provide thumbnail if not defined, or forced, or for large images
$variant = 'inline';
if (!$image['use_thumbnail'] || $image['use_thumbnail'] == 'A' || $image['use_thumbnail'] == 'Y' && $image['image_size'] > $context['thumbnail_threshold']) {
// not inline anymore, but thumbnail
$variant = 'thumbnail';
// where to fetch the image file
$href = Images::get_thumbnail_href($image);