0

You ever notice Google News has relevant images associated with its headlines?

How can I use WordPress to extract a featured image from an external webpage referenced in a blog post (or custom field)?

I'm open to any suggestions. I've seen this kind of functionality on a lot of web sites. There must be a way to do this with WP.

  • I'm not seeing anytning that addresses my question; If you do, could you post a link? – Richard May 16 '12 at 23:46
  • Have you found a solution for this one? – brasofilo Nov 27 '12 at 17:38
1

Found some plugins that may (or not) match your requirements. Using this query string in the repository.

But, there's one (WP-SnapAvatar) that although doesn't address the particulars, consists in a little and very interesting function, that I'll reproduce here:

/*
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);

For what you ask, I think that a combination of WP-SnapAvatar and this other one (Link Indication) would do the job.

But, I won't get into that otherwise I end up writing a new plugin :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.