Got a php script that downloads many images from url, can i make the script work faster?
<p>First i make an array of urls that contain an image (1 url = 1 image, nothing else in that url):</p>

<pre><code>$image_endings = array();
for($x=1;$x&lt;=25;$x++) {
    for($y=1;$y&lt;=48;$y++) {
        $image_endings[] ="${x}n${y}w.png";
    }
}
</code></pre>

<p>Now i run each url and if that url exists, i donwload the image:</p>

<pre><code>foreach ($image_endings as $se){
    $url = 'http://imgs.xkcd.com/clickdrag/'.$se;

if (@GetImageSize($url)) {

//echo  "image exists ";
    $img = file_get_contents($url);
    file_put_contents("tiles/".$se,$img);

    $width = 50;
    $height = 50;
    $filename = 'tiles/'.$se;
    $image = imagecreatefrompng ( $filename );
    $new_image = imagecreatetruecolor ( $width, $height ); // new wigth and height
    imagealphablending($new_image , false);
    imagesavealpha($new_image , true);
    imagecopyresampled ( $new_image, $image, 0, 0, 0, 0, $width, $height, imagesx ( $image ), imagesy ( $image ) );
    $image = $new_image;

    // saving
    imagealphablending($image , false);
    imagesavealpha($image , true);
    imagepng ( $image, $filename );

} else {

// echo  "image does not exist ";
</code></pre>

<p>}</p>

<p>The problem with this script - it takes ~5minutes to completely finish. I was wondering if i can make it run faster?</p>
