本文整理汇总了PHP中get_thumbnail函数的典型用法代码示例。如果您正苦于以下问题:PHP get_thumbnail函数的具体用法?PHP get_thumbnail怎么用?PHP get_thumbnail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_thumbnail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_thumbnail
function get_thumbnail($dir)
{
$list = lister($dir, FALSE);
// we don't care about thumbs, so save some time
if (isset($list['picture']['thumbnail.jpg']) === TRUE) {
return 'thumbnail.jpg';
} else {
if (isset($list['picture']) === TRUE && sizeof($list['picture']) > 0) {
// get first picture file in the folder
$key = key($list['picture']);
// get current value
return $list['picture'][$key]['big'];
} else {
if (isset($list['folder']) === TRUE && sizeof($list['folder']) > 0) {
// search in sub folders
foreach ($list['folder'] as $a_folder) {
// recursivity FTW
$a_folder_thumb = get_thumbnail($dir . '/' . $a_folder);
if ($a_folder_thumb !== '') {
return $a_folder . '/' . $a_folder_thumb;
}
}
}
}
}
return '';
// nothing was found
}
示例2: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? 'Photostream' : $instance['title']);
$posts_number = empty($instance['posts_number']) ? '' : $instance['posts_number'];
$blog_category = empty($instance['blog_category']) ? '' : $instance['blog_category'];
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<div class="photostream clearfix">
<?php
query_posts("showposts=" . $posts_number . "&cat=" . $blog_category);
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<?php
$thumb = '';
$width = 67;
$height = 67;
$classtext = 'post-thumb';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Entry');
$thumb = $thumbnail["thumb"];
?>
<div class="thumb">
<a href="<?php
the_permalink();
?>
">
<?php
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext);
?>
<span class="overlay"></span>
</a>
</div> <!-- end .post-thumbnail -->
<?php
}
}
wp_reset_query();
?>
</div> <!-- end .photostream -->
<?php
echo $after_widget;
}
示例3: render_link
function render_link($id, $title, $author, $app_id, $self = TRUE)
{
$output = '<div class="tomove">';
$output .= '<h2>' . $title . '</h2>';
$output .= '<a ';
if (!$self) {
$output .= 'target="_blank" ';
}
$output .= 'href="' . $app_id . '">';
$img = get_thumbnail($id);
$output .= '<img alt="' . $title . ' by ' . $author . '" class="thumbnail img-responsive" src="' . $img . '" />';
$output .= '</a>';
//echo '<iframe type="text/html" width="640" height="390" src="http://www.youtube.com/embed/' . $obj->youtube_id . '" frameborder="0"/>';
$output .= '<span class="label label-info">' . $author . '</span>';
$output .= '</div>';
return $output;
}
示例4: is_front_page
$et_paged = is_front_page() ? get_query_var('page') : get_query_var('paged');
?>
<?php
query_posts("posts_per_page={$et_ptemplate_gallery_perpage}&paged=" . $et_paged . $gallery_query);
?>
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<?php
$width = 207;
$height = 136;
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, 'portfolio', $titletext, $titletext, true, 'Portfolio');
$thumb = $thumbnail["thumb"];
?>
<div class="et_pt_gallery_entry">
<div class="et_pt_item_image">
<?php
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, 'portfolio');
?>
<span class="overlay"></span>
<a class="zoom-icon fancybox" title="<?php
the_title_attribute();
?>
" rel="gallery" href="<?php
echo $thumbnail['fullpath'];
示例5: the_title
the_title();
?>
</h1>
<span class="et_project_categories"><?php
echo get_the_term_list(get_the_ID(), 'project_category', '', ', ');
?>
</span>
</div>
<?php
$thumb = '';
$width = (int) apply_filters('et_pb_portfolio_single_image_width', 1080);
$height = (int) apply_filters('et_pb_portfolio_single_image_height', 9999);
$classtext = 'et_featured_image';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Projectimage');
$thumb = $thumbnail["thumb"];
$page_layout = get_post_meta(get_the_ID(), '_et_pb_page_layout', true);
if ('' !== $thumb) {
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height);
}
?>
<?php
}
?>
<div class="entry-content">
<?php
the_content();
if (!$is_page_builder_used) {
示例6: et_pb_filterable_portfolio
function et_pb_filterable_portfolio($atts)
{
extract(shortcode_atts(array('module_id' => '', 'module_class' => '', 'fullwidth' => 'on', 'posts_number' => 10, 'include_categories' => '', 'show_title' => 'on', 'show_categories' => 'on', 'show_pagination' => 'on', 'background_layout' => 'light'), $atts));
wp_enqueue_script('jquery-masonry-3');
wp_enqueue_script('hashchange');
$args = array();
if ('on' === $show_pagination) {
$args['nopaging'] = true;
} else {
$args['posts_per_page'] = (int) $posts_number;
}
if ('' !== $include_categories) {
$args['tax_query'] = array(array('taxonomy' => 'project_category', 'field' => 'id', 'terms' => explode(',', $include_categories), 'operator' => 'IN'));
}
$projects = et_divi_get_projects($args);
$categories_included = array();
ob_start();
if ($projects->post_count > 0) {
while ($projects->have_posts()) {
$projects->the_post();
$category_classes = array();
$categories = get_the_terms(get_the_ID(), 'project_category');
if ($categories) {
foreach ($categories as $category) {
$category_classes[] = 'project_category_' . $category->slug;
$categories_included[] = $category->term_id;
}
}
$category_classes = implode(' ', $category_classes);
?>
<div id="post-<?php
the_ID();
?>
" <?php
post_class('et_pb_portfolio_item ' . $category_classes);
?>
>
<?php
$thumb = '';
$width = 'on' === $fullwidth ? 1080 : 400;
$width = (int) apply_filters('et_pb_portfolio_image_width', $width);
$height = 'on' === $fullwidth ? 9999 : 284;
$height = (int) apply_filters('et_pb_portfolio_image_height', $height);
$classtext = 'on' === $fullwidth ? 'et_pb_post_main_image' : '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Blogimage');
$thumb = $thumbnail["thumb"];
if ('' !== $thumb) {
?>
<a href="<?php
the_permalink();
?>
">
<?php
if ('on' !== $fullwidth) {
?>
<span class="et_portfolio_image">
<?php
}
?>
<?php
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height);
?>
<?php
if ('on' !== $fullwidth) {
?>
<span class="et_overlay"></span>
</span>
<?php
}
?>
</a>
<?php
}
?>
<?php
if ('on' === $show_title) {
?>
<h2><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<?php
}
?>
<?php
if ('on' === $show_categories) {
?>
<p class="post-meta"><?php
echo get_the_term_list(get_the_ID(), 'project_category', '', ', ');
?>
</p>
<?php
}
?>
//.........这里部分代码省略.........
示例7: et_show_ajax_project
function et_show_ajax_project()
{
global $wp_embed;
$project_id = (int) $_POST['et_project_id'];
$portfolio_args = array('post_type' => 'project', 'p' => $project_id);
$portfolio_query = new WP_Query(apply_filters('et_ajax_portfolio_args', $portfolio_args));
while ($portfolio_query->have_posts()) {
$portfolio_query->the_post();
global $post;
$width = (int) apply_filters('et_ajax_media_width', 600);
$height = (int) apply_filters('et_ajax_media_height', 480);
$titletext = get_the_title();
$media = get_post_meta(get_the_ID(), '_et_used_images', true);
echo '<div class="et_media">';
if ($media) {
echo '<div class="flexslider"><ul class="slides">';
foreach ((array) $media as $et_media) {
echo '<li class="slide">';
if (is_numeric($et_media)) {
$et_fullimage_array = wp_get_attachment_image_src($et_media, 'full');
if ($et_fullimage_array) {
$et_fullimage = $et_fullimage_array[0];
echo '<img src="' . esc_attr(et_new_thumb_resize(et_multisite_thumbnail($et_fullimage), $width, $height, '', true)) . '" width="' . esc_attr($width) . '" height="' . esc_attr($height) . '" alt="' . esc_attr($titletext) . '" />';
}
} else {
$video_embed = apply_filters('the_content', $wp_embed->shortcode('', esc_url($et_media)));
$video_embed = preg_replace('/<embed /', '<embed wmode="transparent" ', $video_embed);
$video_embed = preg_replace('/<\\/object>/', '<param name="wmode" value="transparent" /></object>', $video_embed);
$video_embed = preg_replace("/height=\"[0-9]*\"/", "height={$height}", $video_embed);
$video_embed = preg_replace("/width=\"[0-9]*\"/", "width={$width}", $video_embed);
echo $video_embed;
}
echo '</li>';
}
echo '</ul></div>';
} else {
$thumb = '';
$classtext = '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Ajaximage');
$thumb = $thumbnail["thumb"];
echo '<a href="' . esc_url(get_permalink()) . '">';
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext);
echo '</a>';
}
echo '</div> <!-- end .et_media -->';
echo '<div class="et_media_description">' . '<h2 class="title">' . '<a href="' . get_permalink() . '">' . get_the_title() . '</a>' . '</h2>' . truncate_post(560, false);
echo '</div> <!-- end .et_media_description -->';
echo '<a class="more" href="' . get_permalink() . '">' . __('More info »', 'Flexible') . '</a>';
}
wp_reset_postdata();
die;
}
示例8: success_template
}
if(isset($success))
{
echo success_template('Image was successfully uploaded <a class="btn btn-sm btn-primary" href="'.current_url().'">Refresh page</a>');
}
?>
<input type="hidden" name="user_id" value="<?=$user_id?>" class="form-control" id="user_id" >
<div class="form-group">
<label class="col-md-2 control-label"></label>
<div class="col-md-10">
<div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px;"><img src="<?=base_url().'uploads/avatars/'.get_thumbnail($avatar)?>"></div>
<?php
$data = array
(
'name' => 'userfile',
'id' => 'userfile',
'value' => set_value('userfile'),
'maxlength' => '',
'size' => '',
'style' => '',
'class' => 'fileinput btn-info',
'data-filename-placement' =>'inside',
'title' =>'New filename goes inside'
);
echo form_upload($data);
示例9: while
<div id="content-area">
<div class="container clearfix fullwidth">
<div id="main-area">
<?php
while (have_posts()) {
the_post();
?>
<article class="entry clearfix">
<?php
$thumb = '';
$width = (int) apply_filters('et_single_project_image_width', 9999);
$height = (int) apply_filters('et_single_project_image_height', 9999);
$classtext = 'et-main-project-thumb';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'SingleProject');
$thumb = $thumbnail["thumb"];
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext);
the_content();
et_gallery_images();
wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'Vertex'), 'after' => '</div>'));
?>
</article> <!-- .entry -->
<?php
if (comments_open() && 'on' == et_get_option('vertex_show_postcomments', 'on')) {
comments_template('', true);
}
}
?>
示例10: shortcode_callback
function shortcode_callback($atts, $content = null, $function_name)
{
$module_id = $this->shortcode_atts['module_id'];
$module_class = $this->shortcode_atts['module_class'];
$fullwidth = $this->shortcode_atts['fullwidth'];
$posts_number = $this->shortcode_atts['posts_number'];
$include_categories = $this->shortcode_atts['include_categories'];
$meta_date = $this->shortcode_atts['meta_date'];
$show_thumbnail = $this->shortcode_atts['show_thumbnail'];
$show_content = $this->shortcode_atts['show_content'];
$show_author = $this->shortcode_atts['show_author'];
$show_date = $this->shortcode_atts['show_date'];
$show_categories = $this->shortcode_atts['show_categories'];
$show_comments = $this->shortcode_atts['show_comments'];
$show_pagination = $this->shortcode_atts['show_pagination'];
$background_layout = $this->shortcode_atts['background_layout'];
$show_more = $this->shortcode_atts['show_more'];
$offset_number = $this->shortcode_atts['offset_number'];
$masonry_tile_background_color = $this->shortcode_atts['masonry_tile_background_color'];
$use_dropshadow = $this->shortcode_atts['use_dropshadow'];
global $paged;
$module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name);
$container_is_closed = false;
// remove all filters from WP audio shortcode to make sure current theme doesn't add any elements into audio module
remove_all_filters('wp_audio_shortcode_library');
remove_all_filters('wp_audio_shortcode');
remove_all_filters('wp_audio_shortcode_class');
if ('' !== $masonry_tile_background_color) {
ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_blog_grid .et_pb_post', 'declaration' => sprintf('background-color: %1$s;', esc_html($masonry_tile_background_color))));
}
if ('on' !== $fullwidth) {
if ('on' === $use_dropshadow) {
$module_class .= ' et_pb_blog_grid_dropshadow';
}
wp_enqueue_script('salvattore');
$background_layout = 'light';
}
$args = array('posts_per_page' => (int) $posts_number);
$et_paged = is_front_page() ? get_query_var('page') : get_query_var('paged');
if (is_front_page()) {
$paged = $et_paged;
}
if ('' !== $include_categories) {
$args['cat'] = $include_categories;
}
if (!is_search()) {
$args['paged'] = $et_paged;
}
if ('' !== $offset_number && !empty($offset_number)) {
/**
* Offset + pagination don't play well. Manual offset calculation required
* @see: https://codex.wordpress.org/Making_Custom_Queries_using_Offset_and_Pagination
*/
if ($paged > 1) {
$args['offset'] = ($et_paged - 1) * intval($posts_number) + intval($offset_number);
} else {
$args['offset'] = intval($offset_number);
}
}
if (is_single() && !isset($args['post__not_in'])) {
$args['post__not_in'] = array(get_the_ID());
}
ob_start();
query_posts($args);
if (have_posts()) {
?>
<script src="https://cdnjs.cloudflare.com/ajax/libs/masonry/3.3.2/masonry.pkgd.js"></script>
<div class="grid js-masonry"
data-masonry-options='{ "itemSelector": ".new-post", "columnWidth": ".grid-sizer", "percentPosition": true}'>
<div class="grid-sizer"></div>
<?php
while (have_posts()) {
the_post();
$post_format = et_pb_post_format();
$thumb = '';
$width = 'on' === $fullwidth ? 1080 : 400;
$width = (int) apply_filters('et_pb_blog_image_width', $width);
$height = 'on' === $fullwidth ? 675 : 250;
$height = (int) apply_filters('et_pb_blog_image_height', $height);
$classtext = 'on' === $fullwidth ? 'et_pb_post_main_image' : '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Blogimage');
$thumb = $thumbnail["thumb"];
$no_thumb_class = '' === $thumb || 'off' === $show_thumbnail ? ' et_pb_no_thumb' : '';
if (in_array($post_format, array('video', 'gallery'))) {
$no_thumb_class = '';
}
?>
<article onclick="location.href='<?php
the_permalink();
?>
';" style="cursor:pointer;" id="post-<?php
the_ID();
?>
" class="new-post <?php
$cat_color = get_the_category();
echo $cat_color[1]->slug;
echo ' ';
?>
//.........这里部分代码省略.........
示例11: delete_image
function delete_image($path, $image_name)
{
//images to delete
$items = array(get_thumbnail($image_name), $image_name);
//delete only if exists
foreach ($items as $item) {
if (check_image_existance($path, $item)) {
unlink($path . $item);
}
}
}
示例12: base_url
<div class="form-group">
<div class="col-sm-9">
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px;">
<?php
//if there is an image
if (get_blog_article_info_by_id($id, 'image'))
{
?>
<img
src="<?= base_url() . 'uploads/blogs/' . get_thumbnail(get_blog_article_info_by_id($id, 'image')) ?>">
<?php
}
?>
</div>
<div>
<?php
$data = array
(
'name' => 'userfile',
'id' => 'userfile',
'value' => set_value('userfile'),
'maxlength' => '',
'size' => '',
示例13: array
<?php
$testimonials_args = array('post_type' => array('testimonial'), 'showposts' => '1', 'orderby' => 'rand');
$testimonials_query = new WP_Query($testimonials_args);
while ($testimonials_query->have_posts()) {
$testimonials_query->the_post();
?>
<div class="testimonials-item">
<div class="testimonials-item-bottom">
<div class="testimonials-item-content">
<?php
$thumb = '';
$width = 56;
$height = 56;
$classtext = 'item-image';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Testimonial');
$thumb = $thumbnail["thumb"];
?>
<?php
if ($thumb != '') {
?>
<div class="thumb">
<?php
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext);
?>
<span class="overlay"></span>
</div> <!-- end .thumb -->
<?php
}
?>
<p class="author"><?php
示例14: et_fable_get_background
function et_fable_get_background()
{
if (has_post_format('gallery')) {
return '';
}
$style = '';
$post_bg_color = ($bg_color = get_post_meta(get_the_ID(), '_et_post_bg_color', true)) && '' !== $bg_color ? $bg_color : '#ffffff';
$post_use_bg_color = 'on' === get_post_meta(get_the_ID(), '_et_use_bg_color', true) ? true : false;
$background = array();
$thumb = '';
$width = (int) apply_filters('et_blog_image_width', 9999);
$height = (int) apply_filters('et_blog_image_height', 9999);
$classtext = '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Indeximage');
$thumb = $thumbnail["thumb"];
// Gallery posts use featured image for the picture in the video container
// so don't allow it to use the featured image for background
if ('' !== $thumb && !has_post_format('video')) {
$background['image'] = $thumb;
}
if (isset($background['image'])) {
$style = sprintf(' style="background-image: url(%s);"', esc_attr($background['image']));
}
// Attaches solid background color to the post if the featured image is not set
// or 'Background Color instead of the Featured Image' is enabled
if ('' === $style || $post_use_bg_color) {
$style = sprintf(' style="background-color: %s;"', esc_attr($post_bg_color));
}
return $style;
}
示例15: get_template_part
<?php
get_template_part('includes/breadcrumbs', 'single');
?>
<?php
while (have_posts()) {
the_post();
?>
<div class="et-map-post">
<?php
$thumb = '';
$width = (int) apply_filters('et_single_listing_image_width', 960);
$height = (int) apply_filters('et_single_listing_image_height', 320);
$classtext = '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'ListingSingle');
$thumb = $thumbnail["thumb"];
?>
<?php
if ('' != $thumb) {
?>
<div class="thumbnail">
<?php
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext);
?>
<div class="et-description">
<h1><?php
the_title();
?>
</h1>