php web image search question
<p>I want to do a picture search engine. I use <code>simple_html_dom</code> and <code>preg_match_all</code> to get all the image, then use <code>getimagesize</code> get all the image size. 
Here is one part of my code.</p>

<pre><code>&lt;?php
header('Content-type:text/html; charset=utf-8');
require_once 'simple_html_dom.php';
$v = 'http://www.jqueryimage.com/';
$html = file_get_html($v);
foreach($html-&gt;find('img') as $element) {
        if( preg_match('#^http:\/\/(.*)\.(jpg|gif|png)$#i',$element-&gt;src)){
            $image = $element-&gt;src;
            //$arr = getimagesize($image); //get image width and height            
            //$imagesize = $arr[0] * $arr[1];  
            echo $image.'&lt;hr /&gt;';
        }
    }
?&gt;
</code></pre>

<p>First qusetion, how to add a judgement so that I can echo the biggest size image? (only one image).</p>

<p>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 <code>/</code> began. 
But how to get the image real url in the situation where image is as a './' or <code>../</code> or <code>../../</code> began? it is difficulty for me to judge how many <code>../</code> in a image, then cut the site url to complement a image real url? </p>

<p>Thanks.</p>
