Forum Moderators: coopster
<img src="http:/*www.example.com/thumbs/$row_rsExample['thumbnail']" <?php $dims = getimagesize("http:/*www.example.com/thumbs/".str_replace(" ","%20",$row_rsExample['thumbnail'])."");?> width="<?php echo $dims[0];?>" height="111" />
As soon as I remove the getimagesize() function the page loads within seconds.
<?php
$thumbpath = "http:/*www.example.com/thumbs/";
$thumbpath .= str_replace(" ","%20",$row_rsExample['thumbnail']);
echo $thumbpath; // for debugging
flush();
$dims = getimagesize($thumbpath);
flush();
print_r($dims); // for debugging
flush();
print("<img src='".$thumbpath."'" width='".$dims[0]."' height='111'>");
flush();
Could the problem be with the server and their php configurations?
One good idea is to keep a database table for your image dimensions.
ID ¦ imagepath ¦ height ¦ width
here it is in pseudo-code:
function imagetag_from_db(imagepath){
if (image is in the database){
return the image tag
}else{
use getimagesize();
write them in the database;
return the image tag
}
}print(imagetag_from_db("myimage.jpg"));
This is a "band-aid" solution; it doens't explain why getimagesize() is going so slowly for you. I've never noticed any sluggishness from getimagesize(), it's usually quite speedy.
The really weird part is that it was working and then stopped...... i wonder if it has something to do with traffic along the network going out and then coming back...
we'll see though.
thanks