I want to do a picture search engine. I use `simple_html_dom` and `preg_match_all` to get all the image, then use `getimagesize` get all the image size.
Here is one part of my code.

PHP Code:
('Content-type:text/html; charset=utf-8');
$v 'http://www.jqueryimage.com/';
$html file_get_html($v);
$html->find('img') as $element) {
$image $element->src;
//$arr = getimagesize($image); //get image width and height
            //$imagesize = $arr[0] * $arr[1]; 
echo $image.'<hr />';
First qusetion, how to add a judgement so that I can echo the biggest size image? (only one image).

Second question, I can get the image real url in these two possibilities, first where image is as a 'http' began, second where image is as a '/' began.
But how to get the image real url in the situation where image is as a './' or '../' or '../../' began? it is difficulty for me to judge how many '../' in a image, then cut the site url to complement a image real url?

Maybe some one is good at php regular expressions or have good idea willing to help me. Thanks.