开发者

Get image from remote sites and display smaller with PHP

I'm looking for a way to get images from tweets.

I've been able to get tweets from users using oauth lib, etc.

Now, I have parsed each tweet and have to extract just开发者_JAVA技巧 the image from it. I'll use only yfrog, twitpic and lockerz.

I know yfrog.com image is named main_image inside a <div class="the-image dont-hide">

So, how can I get the image src from main_image img tag, resize it to 100x100, and display it, perhaps using gd.


You should be able to use the APIs from each service to be able to get the source URL, I know for Yfrog and Lockerz it's possible, you just need to pass through the ID of the image, which should be part of the link in the original Tweet.

Once you have the URL, you could use TimThumb (http://www.darrenhoyt.com/2008/04/02/timthumb-php-script-released/) to resize the images, this will then cache the external image on your server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜