Optimizing this code...
Posted: Mon May 22, 2006 11:03 am
I have this code into a site, in every pages of them but it causes slow down.
This code shows a image from phpBB garage, from it folder...
I don´t have any ideia to solve this problem
A friend told me to improve the speed by save the image and just to show every hour or even per day. This can be a good solution but I don´t know how implement them, any ideia is appreciated .
Code: Select all
<?php
//Copyright by powerPT
$url_rand = array();
$url = "http:/www.xpto.com/";
$path = "/home/xpto/phpBB2/garage/upload";
$cnt=0;
foreach (glob("$path/garage_gallery-*_thumb.jpg") as $nome) {
$aux = "$nome";
$url = substr($aux,17,strlen($aux)-1);
$cnt = $cnt +1;
$url_rand[$cnt] = $url;
}
$valor = array_rand($url_rand,1);
echo "<img src=\"../../../../" . $url_rand[$valor] . " \" width=\"150\" height=\"112\" alt=\"\" />";
exit();
?>I don´t have any ideia to solve this problem
A friend told me to improve the speed by save the image and just to show every hour or even per day. This can be a good solution but I don´t know how implement them, any ideia is appreciated .