开发者

php fetchpage() function help, identifying image sizes from a url in php

开发者 https://www.devze.com 2023-03-07 03:31 出处:网络
hey guys so im building an application and one of teh features it will have is the ability to show photo links from twitter inline sort of like what tweetdeck has done in their chrome browser version

hey guys so im building an application and one of teh features it will have is the ability to show photo links from twitter inline sort of like what tweetdeck has done in their chrome browser version and sites like crowdreel have been able to do, i spent some time researching how to grab image tags from urls on google and found this fantastic script http://www.bitrepository.com/extract-images-from-an-url.html

the script is great and does exactly what i need, however now my challenge is that the array returned from the links returns every image in the page including thumbnails ads etc, so a link to a page like this: http://lockerz.com/s/69901787

will return an array with quite a few image links to sort through, however what i need is a link to the main image so that i can display it inline with tweets, my idea is that i run some sort of code to figure out which of the images in the page is the largest? what are your thoughts on this? is this the right method or is there something easier thats built in开发者_如何学Pythonto php perhaps? thanks for all your help guys!


Once you have the links to the images you can pass them to the getimagesize() function in PHP.

Look at this example: http://php.net/manual/en/function.getimagesize.php#example-2267

0

精彩评论

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