Php 加载文章缩略图格式的全尺寸图像

Php 加载文章缩略图格式的全尺寸图像,php,wordpress,Php,Wordpress,由于使用了放大镜脚本,我需要在文章中加载全尺寸图像,即使客户选择的是大、中等缩略图大小 我的意思不是帖子的缩略图,我是指嵌入帖子本身的图像。因此,任何与“post”thumnail相关的函数都没有太大帮助,我认为…:-) 例如。。。应生成以下代码: <img src="..../uploads/image.png" width="300" height="500" /> 而不是 <img src="..../uploads/image-300x500.png" width

由于使用了放大镜脚本,我需要在文章中加载全尺寸图像,即使客户选择的是大、中等缩略图大小

我的意思不是帖子的缩略图,我是指嵌入帖子本身的图像。因此,任何与“post”thumnail相关的函数都没有太大帮助,我认为…:-)

例如。。。应生成以下代码:

<img src="..../uploads/image.png" width="300" height="500" />

而不是

<img src="..../uploads/image-300x500.png" width="300" height="500" />


有人对此有很酷的想法吗?谢谢

您可以使用
image\u send\u to\u editor
过滤器提供由您构建的标记,在其中显示完整图像,如下面的代码所示:

add_filter( 'image_send_to_editor', 'my_insert_image', 10, 9 );

function my_insert_image(  $html, $id, $caption, $title, $align, $url, $size, $alt ) {
    list( $img_src, $width, $height ) = image_downsize($id, $size);
    $hwstring = image_hwstring($width, $height);
    $class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id;
    $img_src = wp_get_attachment_image_src( $id, 'full' );
    $html = '<img src="' . esc_attr($img_src[0]) . '" alt="' . esc_attr($alt) . '" ' . $title . $hwstring . 'class="' . $class . '" />';

    return $html;
}
add_filter('image_send_to_editor','my_insert_image',10,9);
函数my_insert_image($html、$id、$caption、$title、$align、$url、$size、$alt){
列表($img_src,$width,$height)=图像缩小($id,$size);
$hwstring=图像_hwstring($width,$height);
$class='align'.esc_attr($align)。'size-'.esc_attr($size)。'wp image-'.$id;
$img_src=wp_get_attachment_image_src($id,'full');
$html='';
返回$html;
}
可能重复Nope:-)您指的线程是用于post\u缩略图…:-)