这与主题无关。
Flickr oEmbed正在返回一个名称以结尾的图像文件_n.jpg
, 实际上,它的宽度为320px。更大的版本以_b.jpg
我们需要使用的过滤器挂钩是embed_oembed_html
.
以下操作返回html的结果以增加图像大小,请检查注释:
add_filter( \'embed_oembed_html\', \'wpse_77745_flickr\', 10, 4 );
function wpse_77745_flickr( $html, $url, $attr, $post_ID )
{
// Check if oEmbedding from Flicker
$provider = parse_url( $url );
if( \'www.flickr.com\' != $provider[\'host\'] )
return $html;
// Get the image attributes from $html
// http://stackoverflow.com/q/138313/1287812
preg_match_all( \'/(alt|title|src)=("[^"]*")/i\', $html, $img );
// Change small for big
$src = str_replace( \'_n.jpg\', \'_b.jpg\', $img[2][0] );
// Build output
// SRC and ALT vars already contain quotes
$big_flick = "<a href=\'{$url}\'><img src={$src} alt={$img[2][4]} width=\'{$attr["width"]}\' height=\'{$attr["width"]}\'></a>";
return $big_flick;
}
作为参考,参数值:
$html => \'<a href="http://www.flickr.com/photos/maheshguild/8299345724/"><img src="https://i.stack.imgur.com/f31ow.jpg" alt="Flamingos !!!" width="320" height="213" /></a>\'
$url => \'http://www.flickr.com/photos/maheshguild/8299345724/\'
$attr => array(
[\'width\'] => 625
[\'height\'] => 938
)
$post_ID => 143
使用FireHP(
library 和
add-on ).