你有没有注意到谷歌新闻的头条有相关图片?
如何使用WordPress从博客帖子(或自定义字段)中引用的外部网页中提取特征图像?
我愿意接受任何建议。我在很多网站上都见过这种功能。必须有一种方法可以使用WP实现这一点。
你有没有注意到谷歌新闻的头条有相关图片?
如何使用WordPress从博客帖子(或自定义字段)中引用的外部网页中提取特征图像?
我愿意接受任何建议。我在很多网站上都见过这种功能。必须有一种方法可以使用WP实现这一点。
找到了一些可能(或不)符合您要求的插件。使用此query string 在存储库中。
/*
Plugin Name: WP-SnapAvatar
Version: 1.0
Plugin URI: http://darkx-studios.com/
Description: This plugin puts the commentor\'s website screenshot where there is no gravatar.
Author: Neacsu Alexandru
Author URI: http://darkx-studios.com
Copyright (c) 2008
Released under the GPL license
http://www.gnu.org/licenses/gpl.txt
*/
function site_avatar_hook($baseCode) {
$AutorUrl = get_comment_author_url();
$PictureLink = "http://images.websnapr.com/?url=$AutorUrl";
preg_match(\'@http://[^"\\\']+["\\\']@\',$baseCode,$newSrc);
$newSrc = $newSrc[0];
if(trim($AutorUrl)){
$httpSrc = substr($newSrc,0,strlen($newSrc) - 1) . "&nocatch=" . rand(10,100) ."&default=" . $PictureLink;
$newAvatar=preg_replace(\'@src=(["\\\'])http://[^"\\\']+["\\\']@\',"src=\'" . $httpSrc . "\'",$baseCode);
} else {
$newAvatar = $baseCode;
}
echo $newAvatar;
}
add_filter(\'get_avatar\',\'site_avatar_hook\',5,4);
对于你所问的,我认为WP SnapAvatar和另一个的组合(Link Indication) 会完成这项工作。但是,我不会深入讨论这个问题,否则我会编写一个新插件:)