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

PHP get_image_tag函数代码示例

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

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



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

示例1: render

 public function render($classNames = null, $alt = null, $title = null)
 {
     $this->classNames = $classNames;
     add_filter('get_image_tag_class', [$this, 'getClassNames'], 10);
     $img = self::removeHeightAndWidthAttributes(get_image_tag($this->ID, $alt, $title, null, null));
     remove_filter('get_image_tag_class', [$this, 'getClassNames'], 10);
     return $img;
 }
开发者ID:expresser,项目名称:posttype,代码行数:8,代码来源:Image.php


示例2: get_image_send_to_editor

function get_image_send_to_editor($id, $alt, $title, $align, $url = '', $rel = false, $size = 'medium')
{
    $html = get_image_tag($id, $alt, $title, $align, $size);
    $rel = $rel ? ' rel="attachment wp-att-' . attribute_escape($id) . '"' : '';
    if ($url) {
        $html = '<a href="' . clean_url($url) . "\"{$rel}>{$html}</a>";
    }
    $html = apply_filters('image_send_to_editor', $html, $id, $alt, $title, $align, $url, $size);
    return $html;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:10,代码来源:media.php


示例3: get_image_send_to_editor

function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = false, $size='medium') {

	$html = get_image_tag($id, $alt, $title, $align, $size);

	$rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : '';

	if ( $url )
		$html = "<a href='".attribute_escape($url)."'$rel>$html</a>";

	$html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url );

	return $html;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:13,代码来源:media.php


示例4: ubik_imagery_feed

function ubik_imagery_feed($id = '', $size = '', $alt = '', $align = 'none')
{
    // The `get_image_tag` function requires a simple alignment e.g. "none", "left", etc.
    $align = str_replace('align', '', $align);
    // Size limiter for feeds
    $size_default = apply_filters('ubik_imagery_feed_default_size', 'medium');
    $sizes_metadata = ubik_imagery_sizes_metadata();
    // Default size filter applies here as well
    if (empty($size)) {
        $size = $size_default;
    }
    // Scale down images for the feed; @TODO: replace with an image that has the same aspect ratio
    if (isset($sizes_metadata[$size])) {
        if ($sizes_metadata[$size]['width'] > $sizes_metadata[$size_default]['width']) {
            $size = $size_default;
        }
    }
    // Default image element generator cribbed from WordPress core
    return apply_filters('ubik_imagery_feed', get_image_tag($id, $alt, $title = '', $align, $size));
}
开发者ID:synapticism,项目名称:ubik-imagery,代码行数:20,代码来源:ubik-imagery-core.php


示例5: get_image_send_to_editor

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $id
 * @param unknown_type $alt
 * @param unknown_type $title
 * @param unknown_type $align
 * @param unknown_type $url
 * @param unknown_type $rel
 * @param unknown_type $size
 * @return unknown
 */
function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel = false, $size='medium', $alt = '') {

	$html = get_image_tag($id, $alt, $title, $align, $size);

	$rel = $rel ? ' rel="attachment wp-att-' . esc_attr($id).'"' : '';

	if ( $url )
		$html = '<a href="' . esc_attr($url) . "\"$rel>$html</a>";

	$html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt );

	return $html;
}
开发者ID:realfluid,项目名称:umbaugh,代码行数:27,代码来源:media.php


示例6: pcomm_image_send_to_editor

function pcomm_image_send_to_editor($html, $id, $caption, $title, $align, $url, $size, $alt)
{
    add_filter('disable_captions', create_function('$a', 'return true;'));
    // Manipulate the HTML
    if (!$align) {
        $div_align = 'alignleft';
    } else {
        $div_align = $align;
    }
    $html = get_image_tag($id, $alt, $title, $align = 'none', $size);
    $sizes = wp_get_attachment_image_src($id, $size);
    $width = $sizes[1];
    $height = $sizes[2];
    $hwstring = 'width="' . $width . '" height="' . $height . '"';
    if ($url) {
        $html = '<a href="' . esc_attr($url) . ' ">' . $html . '</a>';
    }
    if (!$caption) {
        return '<div id="attachment_' . $id . '" class="wp-attachment align' . $div_align . '">' . $html . '</div>';
    } else {
        return '<div style="width:' . $width . 'px;" id="attachment_' . $id . '" class="wp-attachment wp-caption align' . $div_align . '">' . '<a href="' . $url . ' ">' . '<img ' . $hwstring . ' src=' . $url . ' alt=' . $title . ' />' . '</a>' . '<p class="wp-caption-text">' . $caption . '</p></div>';
    }
}
开发者ID:yippeethebear,项目名称:bibleclassmaterial,代码行数:23,代码来源:functions.php


示例7: get_image_send_to_editor

/**
 * Retrieves the image HTML to send to the editor.
 *
 * @since 2.5.0
 *
 * @param int          $id      Image attachment id.
 * @param string       $caption Image caption.
 * @param string       $title   Image title attribute.
 * @param string       $align   Image CSS alignment property.
 * @param string       $url     Optional. Image src URL. Default empty.
 * @param string       $rel     Optional. Image rel attribute. Default empty.
 * @param string|array $size    Optional. Image size. Accepts any valid image size, or an array of width
 *                              and height values in pixels (in that order). Default 'medium'.
 * @param string       $alt     Optional. Image alt attribute. Default empty.
 * @return string The HTML output to insert into the editor.
 */
function get_image_send_to_editor($id, $caption, $title, $align, $url = '', $rel = '', $size = 'medium', $alt = '')
{
    $html = get_image_tag($id, $alt, '', $align, $size);
    if (!$rel) {
        $rel = ' rel="attachment wp-att-' . esc_attr($id) . '"';
    } else {
        $rel = ' rel="' . esc_attr($rel) . '"';
    }
    if ($url) {
        $html = '<a href="' . esc_attr($url) . "\"{$rel}>{$html}</a>";
    }
    /**
     * Filter the image HTML markup to send to the editor.
     *
     * @since 2.5.0
     *
     * @param string       $html    The image HTML markup to send.
     * @param int          $id      The attachment id.
     * @param string       $caption The image caption.
     * @param string       $title   The image title.
     * @param string       $align   The image alignment.
     * @param string       $url     The image source URL.
     * @param string|array $size    Size of image. Image size or array of width and height values
     *                              (in that order). Default 'medium'.
     * @param string       $alt     The image alternative, or alt, text.
     */
    $html = apply_filters('image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt);
    return $html;
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:45,代码来源:media.php


示例8: test_wp_make_content_images_responsive_with_preexisting_srcset

 /**
  * @ticket 33641
  */
 function test_wp_make_content_images_responsive_with_preexisting_srcset()
 {
     // Generate HTML and add a dummy srcset attribute.
     $image_html = get_image_tag(self::$large_id, '', '', '', 'medium');
     $image_html = preg_replace('|<img ([^>]+) />|', '<img $1 ' . 'srcset="image2x.jpg 2x" />', $image_html);
     // The content filter should return the image unchanged.
     $this->assertSame($image_html, wp_make_content_images_responsive($image_html));
 }
开发者ID:nkeat12,项目名称:dv,代码行数:11,代码来源:media.php


示例9: test_wp_make_content_images_responsive_schemes

    function test_wp_make_content_images_responsive_schemes()
    {
        $image_meta = wp_get_attachment_metadata(self::$large_id);
        $size_array = array((int) $image_meta['sizes']['medium']['width'], (int) $image_meta['sizes']['medium']['height']);
        $srcset = sprintf('srcset="%s"', wp_get_attachment_image_srcset(self::$large_id, $size_array, $image_meta));
        $sizes = sprintf('sizes="%s"', wp_get_attachment_image_sizes(self::$large_id, $size_array, $image_meta));
        // Build HTML for the editor.
        $img = get_image_tag(self::$large_id, '', '', '', 'medium');
        $img_https = str_replace('http://', 'https://', $img);
        $img_relative = str_replace('http://', '//', $img);
        // Manually add srcset and sizes to the markup from get_image_tag();
        $respimg = preg_replace('|<img ([^>]+) />|', '<img $1 ' . $srcset . ' ' . $sizes . ' />', $img);
        $respimg_https = preg_replace('|<img ([^>]+) />|', '<img $1 ' . $srcset . ' ' . $sizes . ' />', $img_https);
        $respimg_relative = preg_replace('|<img ([^>]+) />|', '<img $1 ' . $srcset . ' ' . $sizes . ' />', $img_relative);
        $content = '
			<p>Image, http: protocol. Should have srcset and sizes.</p>
			%1$s

			<p>Image, http: protocol. Should have srcset and sizes.</p>
			%2$s

			<p>Image, protocol-relative. Should have srcset and sizes.</p>
			%3$s';
        $unfiltered = sprintf($content, $img, $img_https, $img_relative);
        $expected = sprintf($content, $respimg, $respimg_https, $respimg_relative);
        $actual = wp_make_content_images_responsive($unfiltered);
        $this->assertSame($expected, $actual);
    }
开发者ID:barkinet,项目名称:wp-tevko-responsive-images,代码行数:28,代码来源:test-suite.php


示例10: fiat_custom_columns

 /**
  * @param $column
  * @return void
  * @since 1.0.0
  * @uses fiat_thumb, thumb
  *
  * Insert representative thumbnail image into Admin Dashboard view
  * for All Posts/Pages if we are on the "thumb" column
  *
  */
 public function fiat_custom_columns($column)
 {
     global $post;
     $post_id = $post->ID;
     switch ($column) {
         case 'thumb':
             if (has_post_thumbnail($post_id)) {
                 // Determine if our image size has been created and use
                 // that size/attribute combination
                 // else get the post-thumbnail image and apply custom sizing to
                 // size it to fit in the admin dashboard
                 $thumbnail_id = get_post_thumbnail_id($post_id);
                 $tpm = wp_get_attachment_metadata($thumbnail_id);
                 $sizes = $tpm['sizes'];
                 // Default to thumbnail size (as this will be sized down reducing the bandwidth until the image thumbnail is regenerated)
                 $fiat_image_size = 'thumbnail';
                 // Review the sizes this particular image has been set to
                 if (is_array($sizes)) {
                     foreach ($sizes as $s => $k) {
                         if ($this->fiat_image_size == $s) {
                             // our size is present, set it and break out
                             $fiat_image_size = $this->fiat_image_size;
                             break;
                         }
                     }
                 }
                 /**
                  * Check if WooCommerce is active
                  * If so, only return anchor link markup to inline edit thumbnail
                  * WooCommerce will supply the image markup
                  **/
                 if ($this->fiat_on_woocommerce_products_list()) {
                     $thumb_url = '';
                 } else {
                     if ('thumbnail' == $fiat_image_size) {
                         // size down this time
                         $thumb_url = wp_get_attachment_image($thumbnail_id, array(60, 60));
                     } else {
                         // use native sized image
                         $thumb_url = get_image_tag($thumbnail_id, '', '', '', $fiat_image_size);
                     }
                 }
                 // Here it is!
                 $this->fiat_nonce = wp_create_nonce('set_post_thumbnail-' . $post_id);
                 $template_html = '<a title="' . __('Change featured image', 'featured-image-admin-thumb-fiat') . '" href="%1$s" id="set-post-thumbnail" class="fiat_thickbox" data-thumbnail-id="%3$d">%2$s<span class="genericon genericon-edit fiat-icon"></span></a>';
                 $html = sprintf($template_html, home_url() . '/wp-admin/media-upload.php?post_id=' . $post_id . '&amp;type=image&amp;TB_iframe=1&_wpnonce=' . $this->fiat_nonce, $thumb_url, $thumbnail_id);
                 // Click me to change!
                 echo $html;
             } else {
                 // This nonce "action" parameter must match the Ajax Referrer action used in the js and PHP
                 // wp-admin/includes/ajax-actions.php wp-includes/pluggable.php
                 // It's like dealing with the IRS. :-)
                 $this->fiat_nonce = wp_create_nonce('set_post_thumbnail-' . $post_id);
                 $set_featured_image = sprintf(__('Set %s featured image', 'featured-image-admin-thumb-fiat'), '<br/>');
                 $set_edit_markup = $this->fiat_on_woocommerce_products_list() ? '<span class="genericon genericon-edit fiat-icon"></span>' : $set_featured_image;
                 $template_html = '<a title="' . __('Set featured image', 'featured-image-admin-thumb-fiat') . '" href="%1$s" id="set-post-thumbnail" class="fiat_thickbox" >%2$s</a>';
                 $html = sprintf($template_html, home_url() . '/wp-admin/media-upload.php?post_id=' . $post_id . '&amp;type=image&amp;TB_iframe=1&_wpnonce=' . $this->fiat_nonce, $set_edit_markup);
                 // Click me!
                 echo $html;
             }
             break;
     }
 }
开发者ID:Ecotrust,项目名称:ocs-wp,代码行数:73,代码来源:class-featured-image-admin-thumb-admin.php


示例11: scwd_single_do_tax_image

function scwd_single_do_tax_image($title)
{
    global $post, $SCWD_CUSTOM;
    if (is_single()) {
        global $post;
        // to do: get tax dynamically
        $tax = 'category';
        $image_size = 'Panoramic Large';
        if (false !== ($image_id = $SCWD_CUSTOM->acf_get_field('_feature_image'))) {
            print '<div class="tax-image">' . get_image_tag($image_id, $post->post_title, $post->post_title, '', $image_size) . '</div>';
        } else {
            print apply_filters('taxonomy-images-list-the-terms', '', array('before' => '', 'after' => '', 'before_image' => '<div class="tax-image">', 'after_image' => '</div>', 'image_size' => $image_size, 'taxonomy' => $tax));
        }
    }
}
开发者ID:scarydakis,项目名称:WPTest,代码行数:15,代码来源:functions.php


示例12: print_image

/**
 * Simple print of a image tag.
 *
 * @param int $image_id
 * @param string|array $size
 * @param array $options
 */
function print_image($image_id, $size, array $options = [])
{
    echo get_image_tag($image_id, $size, $options);
}
开发者ID:andrefelipe,项目名称:bond,代码行数:11,代码来源:utils-media.php


示例13: get_image_html

 public function get_image_html($size = 'medium', $term_tax_id = false, $title = true, $align = 'none')
 {
     $o = '';
     if (false === $term_tax_id) {
         global $wp_query;
         $obj = $wp_query->get_queried_object();
         if (isset($obj->term_taxonomy_id)) {
             $term_tax_id = $obj->term_taxonomy_id;
         } else {
             return false;
         }
     }
     $term_tax_id = (int) $term_tax_id;
     if (isset($this->settings[$term_tax_id])) {
         $attachment_id = (int) $this->settings[$term_tax_id];
         $alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
         $attachment = get_post($attachment_id);
         /* Just in case an attachment was deleted, but there is still a record for it in this plugins settings. */
         if ($attachment !== NULL) {
             $o = get_image_tag($attachment_id, $alt, '', $align, $size);
         }
     }
     return $o;
 }
开发者ID:Roman921,项目名称:Step-21,代码行数:24,代码来源:deprecated.php


示例14: test_tevkori_filter_content_images_with_preexisting_srcset

 /**
  * @group 170
  */
 function test_tevkori_filter_content_images_with_preexisting_srcset()
 {
     // Make image.
     $id = $this->_test_img();
     // Generate HTML and add a dummy srcset attribute.
     $image_html = get_image_tag($id, '', '', '', 'medium');
     $image_html = preg_replace('|<img ([^>]+) />|', '<img $1 ' . 'srcset="image2x.jpg 2x" />', $image_html);
     // The content filter should return the image unchanged.
     $this->assertSame($image_html, tevkori_filter_content_images($image_html));
 }
开发者ID:stanwmusic,项目名称:wp-tevko-responsive-images,代码行数:13,代码来源:test-suite.php


示例15: get_image_send_to_editor

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $id
 * @param unknown_type $alt
 * @param unknown_type $title
 * @param unknown_type $align
 * @param unknown_type $url
 * @param unknown_type $rel
 * @param unknown_type $size
 * @return unknown
 */
function get_image_send_to_editor($id, $alt, $title, $align, $url = '', $rel = false, $size = 'medium')
{
    $htmlalt = empty($alt) ? $title : $alt;
    $html = get_image_tag($id, $htmlalt, $title, $align, $size);
    $rel = $rel ? ' rel="attachment wp-att-' . esc_attr($id) . '"' : '';
    if ($url) {
        $html = '<a target="_blank" href="' . esc_url($url) . "\"{$rel}>{$html}</a>";
    }
    $html = apply_filters('image_send_to_editor', $html, $id, $alt, $title, $align, $url, $size);
    return $html;
}
开发者ID:Alenjandro,项目名称:data-my-share,代码行数:25,代码来源:media.php


示例16: get_image_send_to_editor

/**
 * {@internal Missing Short Description}}
 *
 * @since 2.5.0
 *
 * @param integer $id image attachment id
 * @param string $caption image caption
 * @param string $alt image alt attribute
 * @param string $title image title attribute
 * @param string $align image css alignment property
 * @param string $url image src url
 * @param string|bool $rel image rel attribute
 * @param string $size image size (thumbnail, medium, large, full or added  with add_image_size() )
 * @return string the html to insert into editor
 */
function get_image_send_to_editor($id, $caption, $title, $align, $url = '', $rel = false, $size = 'medium', $alt = '')
{
    $html = get_image_tag($id, $alt, '', $align, $size);
    $rel = $rel ? ' rel="attachment wp-att-' . esc_attr($id) . '"' : '';
    if ($url) {
        $html = '<a href="' . esc_attr($url) . "\"{$rel}>{$html}</a>";
    }
    /**
     * Filter the image HTML markup to send to the editor.
     *
     * @since 2.5.0
     *
     * @param string $html    The image HTML markup to send.
     * @param int    $id      The attachment id.
     * @param string $caption The image caption.
     * @param string $title   The image title.
     * @param string $align   The image alignment.
     * @param string $url     The image source URL.
     * @param string $size    The image size.
     * @param string $alt     The image alternative, or alt, text.
     */
    $html = apply_filters('image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt);
    return $html;
}
开发者ID:HaraShun,项目名称:WordPress,代码行数:39,代码来源:media.php


示例17: pixlr_image_replace

function pixlr_image_replace($id, $alt, $title, $align, $rel = false, $url = '', $size = 'medium')
{
    $htmlalt = empty($alt) ? $title : $alt;
    $html_pixlr = get_image_tag($id, $htmlalt, $title, $align, $size);
    if ($url) {
        $html_pixlr = "<a href=\"javascript:pixlr.overlay.show({image:'" . $url . "'});\"><img src=\"" . $url . "\"/></a>";
    }
    return $html_pixlr;
}
开发者ID:brettu,项目名称:wp_vandalism_plugin,代码行数:9,代码来源:wp_vandalism_plugin.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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