本文整理汇总了PHP中td_util::attachment_get_full_info方法的典型用法代码示例。如果您正苦于以下问题:PHP td_util::attachment_get_full_info方法的具体用法?PHP td_util::attachment_get_full_info怎么用?PHP td_util::attachment_get_full_info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类td_util
的用法示例。
在下文中一共展示了td_util::attachment_get_full_info方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_list_item
protected function render_list_item($item_array, $current_item_id, $current_item_number, $total_items_number)
{
//print_r($item_array);
$buffy = '';
//checking the width of the tile and converting tags, quotes
$smart_list_4_title = '';
if (!empty($item_array['title'])) {
$smart_list_4_title = $item_array['title'];
}
//creating each slide
$buffy .= '<div class="td-item">';
//get image info
$first_img_all_info = td_util::attachment_get_full_info($item_array['first_img_id']);
//image caption
$first_img_caption = '';
if (!empty($first_img_all_info['caption'])) {
$first_img_caption = $first_img_all_info['caption'];
}
$first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'thumbnail');
if (!empty($first_img_info[0])) {
$buffy .= '<figure class="td-slide-smart-list-figure">
<a class="td-sml-link-to-image" href="' . $first_img_all_info['src'] . '" data-caption="' . esc_attr($first_img_all_info['caption'], ENT_QUOTES) . '">
<img src="' . $first_img_info[0] . '"/>
</a>
<figcaption class="td-sml-caption"><div>' . $first_img_caption . '</div></figcaption>
</figure>';
}
//adding description
if (!empty($item_array['description'])) {
$buffy .= '<div class="td-number-and-title"><h2><span class="td-sml-current-item-nr">' . $current_item_number . '</span><span class="td-sml-current-item-title">' . $smart_list_4_title . '</span></h2></div>
<span class="td-sml-description">' . $item_array['description'] . '</span>';
}
$buffy .= '</div>';
return $buffy;
}
示例2: render_list_item
function render_list_item($item_array, $current_item_id, $current_item_number, $total_items_number)
{
//print_r($item_array);
$buffy = '';
//checking the width of the tile
$smart_list_3_title = '';
if (!empty($item_array['title'])) {
//if we need to cut the title to a certain length, for top and bottom titles
if (mb_strlen($item_array['title'], 'UTF-8') > 59) {
$this->smart_list_3_title_between_controls = mb_substr($item_array['title'], 0, 59, 'UTF-8') . '...';
} else {
$this->smart_list_3_title_between_controls = $item_array['title'];
}
//if there are more then 28 chars, add `td-vertical-align-top` class for the main title in the slide
$class_verticle_align_top = '';
if (mb_strlen($item_array['title'], 'UTF-8') > 28) {
$class_verticle_align_top = 'td-vertical-align-top';
}
//converting single and double quotes
//we do this twice because if we check the converted (with htmlentities) string the title will be longer because the tags and quotes will become `<`, `"`, etc
$smart_list_3_title = $item_array['title'];
}
//creating each slide
$buffy .= '<div class="td-item" id="' . $this->smart_list_tip_3_unique_id . '_item_' . $current_item_id . '">';
$buffy .= '<div class="td-number-and-title"><h2><span class="td-sml-current-item-nr">' . $current_item_number . '</span><span class="td-sml-current-item-title">' . $smart_list_3_title . '</span></h2></div>';
//get image info
$first_img_all_info = td_util::attachment_get_full_info($item_array['first_img_id']);
//image caption
$first_img_caption = '';
if (!empty($first_img_all_info['caption'])) {
$first_img_caption = $first_img_all_info['caption'];
}
$first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'medium');
//image and caption
$buffy_image = '';
if (!empty($first_img_info[0])) {
$buffy_image = '
<figure class="td-sml3-display-image td-slide-smart-list-figure">
<a class="td-sml-link-to-image" href="' . $first_img_all_info['src'] . '" id="td-sml3-slide_' . $this->nr_slide_on_smart_list . '" data-caption="' . esc_attr($first_img_all_info['caption'], ENT_QUOTES) . '" >
<img src="' . $first_img_info[0] . '"/>
</a>
<figcaption class="td-sml-caption"><div>' . $first_img_caption . '</div></figcaption>
</figure>';
}
//adding description
$temp_description = '';
if (!empty($item_array['description'])) {
//adding the title to the description; description comes between <p> and </p>, so we need to insert the title after first <p>
$temp_description = substr($item_array['description'], 3);
$buffy .= '<div class="td-sml-description">' . $buffy_image . $temp_description . '</div>';
//bottom title
//$buffy .= '<div class="td-sml3-bottom-title">' . $current_item_number . '. ' . $this->smart_list_3_title_between_controls . '</div>';
}
$buffy .= '</div>';
$this->nr_slide_on_smart_list++;
return $buffy;
}
示例3: render_list_item
protected function render_list_item($item_array, $current_item_id, $current_item_number, $total_items_number)
{
//print_r($item_array);
$buffy = '';
//checking the width of the tile
$smart_list_5_title = '';
if (!empty($item_array['title'])) {
if (mb_strlen($item_array['title'], 'UTF-8') > 55) {
$smart_list_5_title = mb_substr($item_array['title'], 0, 55, 'UTF-8') . '...';
} else {
$smart_list_5_title = $item_array['title'];
}
}
//creating each slide
$buffy .= '<div class="td-item">';
//get image info
$first_img_all_info = td_util::attachment_get_full_info($item_array['first_img_id']);
//image caption
$first_img_caption = '';
if (!empty($first_img_all_info['caption'])) {
$first_img_caption = $first_img_all_info['caption'];
}
if (td_global::$cur_single_template_sidebar_pos == 'no_sidebar') {
$first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'td_1068x0');
} else {
$first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'td_696x0');
}
if (!empty($first_img_info[0])) {
$buffy .= '
<figure class="td-slide-smart-list-figure td-slide-smart-list-5">
<span class="td-sml-current-item-nr">' . $current_item_number . '</span>
<a class="td-sml-link-to-image" href="' . $first_img_all_info['src'] . '" data-caption="' . esc_attr($first_img_all_info['caption'], ENT_QUOTES) . '">
<img src="' . $first_img_info[0] . '"/>
</a>
<figcaption class="td-sml-caption"><div>' . $first_img_caption . '</div></figcaption>
</figure>';
}
//title
$buffy .= '<div class="td-number-and-title"><h2 class="td-sml-current-item-title">' . $smart_list_5_title . '</h2></div>';
//adding description
if (!empty($item_array['description'])) {
$buffy .= '<span class="td-sml-description">' . $item_array['description'] . '</span>';
}
$buffy .= '</div>';
return $buffy;
}
示例4: render_list_item
protected function render_list_item($item_array, $current_item_id, $current_item_number, $total_items_number)
{
//print_r($item_array);
$buffy = '';
// get the title
$smart_list_1_title = '';
if (!empty($item_array['title'])) {
$smart_list_1_title = $item_array['title'];
}
//creating each slide
$buffy .= '<div class="td-item" id="' . $this->smart_list_tip_1_unique_id . '_item_' . $current_item_id . '">';
$buffy .= '<div class="td-number-and-title"><h2 class="td-sml-current-item-title">' . $current_item_number . '. ' . $smart_list_1_title . '</h2></div>';
//get image info
$first_img_all_info = td_util::attachment_get_full_info($item_array['first_img_id']);
//image caption
$first_img_caption = '';
if (!empty($first_img_all_info['caption'])) {
$first_img_caption = $first_img_all_info['caption'];
}
if (td_global::$cur_single_template_sidebar_pos == 'no_sidebar') {
$first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'td_1068x0');
} else {
$first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'td_696x0');
}
if (!empty($first_img_info[0])) {
$buffy .= '
<figure class="td-slide-smart-list-figure td-slide-smart-list-1">
<a class="td-sml-link-to-image" href="' . $first_img_all_info['src'] . '" id="td-sml1-slide_' . $this->nr_slide_on_smart_list . '" data-caption="' . esc_attr($first_img_all_info['caption'], ENT_QUOTES) . '">
<img src="' . $first_img_info[0] . '" />
</a>
<figcaption class="td-sml-caption"><div>' . $first_img_caption . '</div></figcaption>
</figure>
';
}
//adding description
if (!empty($item_array['description'])) {
$buffy .= '<span class="td-sml-description">' . $item_array['description'] . '</span>';
}
$buffy .= '</div>';
$this->nr_slide_on_smart_list++;
return $buffy;
}
示例5: render_list_item
protected function render_list_item($item_array, $current_item_id, $current_item_number, $total_items_number)
{
//print_r($item_array);
$buffy = '';
// render the pagination
$buffy .= $this->callback_render_pagination();
//creating each slide
$buffy .= '<div class="td-item">';
$buffy .= '<h2><span class="td-sml-current-item-title">' . $current_item_number . '. ' . $item_array['title'] . '</span></h2>';
//get image info
$first_img_all_info = td_util::attachment_get_full_info($item_array['first_img_id']);
//image caption
$first_img_caption = '';
if (!empty($first_img_all_info['caption'])) {
$first_img_caption = $first_img_all_info['caption'];
}
//adding description
if (!empty($item_array['description'])) {
$buffy .= '<span class="td-sml-description">' . $item_array['description'] . '</span>';
}
// ad smart list 6
$buffy .= td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'smart_list_7'));
if (td_global::$cur_single_template_sidebar_pos == 'no_sidebar') {
$first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'td_1068x0');
} else {
$first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'td_696x0');
}
if (!empty($first_img_info[0])) {
$buffy .= '
<figure class="td-slide-smart-list-figure td-slide-smart-list-7">
<a class="td-sml-link-to-image" href="' . $first_img_all_info['src'] . '" data-caption="' . esc_attr($first_img_all_info['caption'], ENT_QUOTES) . '">
<img src="' . $first_img_info[0] . '"/>
</a>
<figcaption class="td-sml-caption"><div>' . $first_img_caption . '</div></figcaption>
</figure>';
}
// render the pagination
$buffy .= $this->callback_render_pagination();
$buffy .= '</div>';
return $buffy;
}
示例6: render_list_item
protected function render_list_item($item_array, $current_item_id, $current_item_number, $total_items_number)
{
$buffy = '';
//get the title
$smart_list_3_title = '';
if (!empty($item_array['title'])) {
$smart_list_3_title = $item_array['title'];
}
//creating each slide
$buffy .= '<div class="td-item" id="' . $this->smart_list_tip_3_unique_id . '_item_' . $current_item_id . '">';
$buffy .= '<div class="td-number-and-title"><h2><span class="td-sml-current-item-nr">' . $current_item_number . '</span><span class="td-sml-current-item-title">' . $smart_list_3_title . '</span></h2></div>';
//get image info
$first_img_all_info = td_util::attachment_get_full_info($item_array['first_img_id']);
//image caption
$first_img_caption = '';
if (!empty($first_img_all_info['caption'])) {
$first_img_caption = $first_img_all_info['caption'];
}
$first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'medium');
//image and caption
$buffy_image = '';
if (!empty($first_img_info[0])) {
$buffy_image = '
<figure class="td-sml3-display-image td-slide-smart-list-figure">
<a class="td-sml-link-to-image" href="' . $first_img_all_info['src'] . '" id="td-sml3-slide_' . $this->nr_slide_on_smart_list . '" data-caption="' . esc_attr($first_img_all_info['caption'], ENT_QUOTES) . '" >
<img src="' . $first_img_info[0] . '"/>
</a>
<figcaption class="td-sml-caption"><div>' . $first_img_caption . '</div></figcaption>
</figure>';
}
if (!empty($item_array['description'])) {
$buffy .= '<div class="td-sml-description">' . $buffy_image . $item_array['description'] . '</div>';
}
$buffy .= '</div>';
$this->nr_slide_on_smart_list++;
return $buffy;
}
示例7: get_image
/**
* v3 23 ian 2015
* @param $thumbType
* @return string
*/
function get_image($thumbType)
{
global $page;
// if ( //check to see if the current single template is configured to show the featured image on the second page
// !isset( td_global::$single_templates_list[td_global::$cur_single_template]['show_featured_image_on_all_pages'] )
// or td_global::$single_templates_list[td_global::$cur_single_template]['show_featured_image_on_all_pages'] === false
// ){
if (td_api_single_template::_check_show_featured_image_on_all_pages(td_global::$cur_single_template) === false) {
//the post is configured to show the featured image only on the first page
if (!empty($page) and $page > 1) {
return '';
}
}
//do not show the featured image if the global setting is set to hide - show the video preview regardless of the setting
if (td_util::get_option('tds_show_featured_image') == 'hide' and get_post_format($this->post->ID) != 'video') {
return '';
}
//handle video post format
if (get_post_format($this->post->ID) == 'video') {
//if it's a video post...
$td_post_video = get_post_meta($this->post->ID, 'td_post_video', true);
$td_video_support = new td_video_support();
//render the video if the post has a video in the featured video section of the post
if (!empty($td_post_video['td_video'])) {
return $td_video_support->renderVideo($td_post_video['td_video']);
}
} else {
//if it's a normal post, show the default thumb
if ($this->post_has_thumb) {
//get the featured image id + full info about the 640px wide one
$featured_image_id = get_post_thumbnail_id($this->post->ID);
$featured_image_info = td_util::attachment_get_full_info($featured_image_id, $thumbType);
//get the full size for the popup
$featured_image_full_size_src = td_util::attachment_get_src($featured_image_id, 'full');
$buffy = '';
$show_td_modal_image = td_util::get_option('tds_featured_image_view_setting');
if (is_single()) {
if ($show_td_modal_image != 'no_modal') {
//wrap the image_html with a link + add td-modal-image class
$image_html = '<a href="' . $featured_image_full_size_src['src'] . '" data-caption="' . esc_attr($featured_image_info['caption'], ENT_QUOTES) . '">';
$image_html .= '<img width="' . $featured_image_info['width'] . '" height="' . $featured_image_info['height'] . '" itemprop="image" class="entry-thumb td-modal-image" src="' . $featured_image_info['src'] . '" alt="' . $featured_image_info['alt'] . '" title="' . $featured_image_info['title'] . '"/>';
$image_html .= '</a>';
} else {
//no_modal
$image_html = '<img width="' . $featured_image_info['width'] . '" height="' . $featured_image_info['height'] . '" itemprop="image" class="entry-thumb" src="' . $featured_image_info['src'] . '" alt="' . $featured_image_info['alt'] . '" title="' . $featured_image_info['title'] . '"/>';
}
} else {
//on blog index page
$image_html = '<a href="' . $this->href . '"><img width="' . $featured_image_info['width'] . '" height="' . $featured_image_info['height'] . '" itemprop="image" class="entry-thumb" src="' . $featured_image_info['src'] . '" alt="' . $featured_image_info['alt'] . '" title="' . $featured_image_info['title'] . '"/></a>';
}
$buffy .= '<div class="td-post-featured-image">';
// caption - put html5 wrapper on when we have a caption
if (!empty($featured_image_info['caption'])) {
$buffy .= '<figure>';
$buffy .= $image_html;
$buffy .= '<figcaption class="wp-caption-text">' . $featured_image_info['caption'] . '</figcaption>';
$buffy .= '</figure>';
} else {
$buffy .= $image_html;
}
$buffy .= '</div>';
return $buffy;
} else {
return '';
//the post has no thumb
}
}
}
示例8: td_gallery_shortcode
/**
* @param string $output - is empty !!!
* @param $atts
* @param bool $content
* @return mixed
*/
function td_gallery_shortcode($output = '', $atts, $content = false)
{
$buffy = '';
//check for gallery = slide
if (!empty($atts) and !empty($atts['td_select_gallery_slide']) and $atts['td_select_gallery_slide'] == 'slide') {
$td_double_slider2_no_js_limit = 7;
$td_nr_columns_slide = 'td-slide-on-2-columns';
$nr_title_chars = 95;
//check to see if we have or not sidebar on the page, to set the small images when need to show them on center
if (td_global::$cur_single_template_sidebar_pos == 'no_sidebar') {
$td_double_slider2_no_js_limit = 11;
$td_nr_columns_slide = 'td-slide-on-3-columns';
$nr_title_chars = 170;
}
$title_slide = '';
//check for the title
if (!empty($atts['td_gallery_title_input'])) {
$title_slide = $atts['td_gallery_title_input'];
//check how many chars the tile have, if more then 84 then that cut it and add ... after
if (mb_strlen($title_slide, 'UTF-8') > $nr_title_chars) {
$title_slide = mb_substr($title_slide, 0, $nr_title_chars, 'UTF-8') . '...';
}
}
$slide_images_thumbs_css = '';
$slide_display_html = '';
$slide_cursor_html = '';
$image_ids = explode(',', $atts['ids']);
//check to make sure we have images
if (count($image_ids) == 1 and !is_numeric($image_ids[0])) {
return;
}
$image_ids = array_map('trim', $image_ids);
//trim elements of the $ids_gallery array
//generate unique gallery slider id
$gallery_slider_unique_id = td_global::td_generate_unique_id();
$cur_item_nr = 1;
foreach ($image_ids as $image_id) {
//get the info about attachment
$image_attachment = td_util::attachment_get_full_info($image_id);
//get images url
$td_temp_image_url_80x60 = wp_get_attachment_image_src($image_id, 'td_80x60');
//for the slide - for small images slide popup
$td_temp_image_url_full = $image_attachment['src'];
//default big image - for magnific popup
//if we are on full wight (3 columns use the default images not the resize ones)
if (td_global::$cur_single_template_sidebar_pos == 'no_sidebar') {
$td_temp_image_url = wp_get_attachment_image_src($image_id, 'td_1021x580');
//1021x580 images - for big slide
} else {
$td_temp_image_url = wp_get_attachment_image_src($image_id, 'td_0x420');
//0x420 image sizes - for big slide
}
//check if we have all the images
if (!empty($td_temp_image_url[0]) and !empty($td_temp_image_url_80x60[0]) and !empty($td_temp_image_url_full)) {
//css for display the small cursor image
$slide_images_thumbs_css .= '
#' . $gallery_slider_unique_id . ' .td-doubleSlider-2 .td-item' . $cur_item_nr . ' {
background: url(' . $td_temp_image_url_80x60[0] . ') 0 0 no-repeat;
}';
//html for display the big image
$class_post_content = '';
if (!empty($image_attachment['description']) or !empty($image_attachment['caption'])) {
$class_post_content = 'td-gallery-slide-content';
}
//if picture has caption & description
$figcaption = '';
if (!empty($image_attachment['caption']) or !empty($image_attachment['description'])) {
$figcaption = '<figcaption class = "td-slide-caption ' . $class_post_content . '">';
if (!empty($image_attachment['caption'])) {
$figcaption .= '<div class = "td-gallery-slide-copywrite">' . $image_attachment['caption'] . '</div>';
}
if (!empty($image_attachment['description'])) {
$figcaption .= '<span>' . $image_attachment['description'] . '</span>';
}
$figcaption .= '</figcaption>';
}
$slide_display_html .= '
<div class = "td-slide-item td-item' . $cur_item_nr . '">
<figure class="td-slide-galery-figure td-slide-popup-gallery">
<a class="slide-gallery-image-link" href="' . $td_temp_image_url_full . '" title="' . $image_attachment['title'] . '" data-caption="' . esc_attr($image_attachment['caption'], ENT_QUOTES) . '" data-description="' . htmlentities($image_attachment['description'], ENT_QUOTES) . '">
<img src="' . $td_temp_image_url[0] . '" alt="' . htmlentities($image_attachment['alt'], ENT_QUOTES) . '">
</a>
' . $figcaption . '
</figure>
</div>';
//html for display the small cursor image
$slide_cursor_html .= '
<div class = "td-button td-item' . $cur_item_nr . '">
<div class = "td-border"></div>
</div>';
$cur_item_nr++;
}
//end check for images
}
//.........这里部分代码省略.........