Andy-H Posted November 20, 2008 Share Posted November 20, 2008 I have this script to display images and this part of the code is running (extremely) slowly, can anyone point out why and possibly a way to improve the load time. for ($i = $_SESSION['x']; $n < 25; $i++){ $file = "http://vle.tameside.ac.uk/user/pix.php/" . $i . "/f1.jpg"; $type = @getimagesize($file); $type = $type['mime']; if ($type == "image/jpeg"){ ++$n; echo ' <td align="center" width="100" height="125"> <label for="' . $i . '"><img src="' . $file . '" width="100" height="100" alt="' . $i . '"></label><br><input type="checkbox" name="studId[]" value="' . $i . '" id="' . $i . '"> </td> '; if ($n % 5 == 0){ echo ' </tr> <tr> '; } } } Thanks for any help. Quote Link to comment https://forums.phpfreaks.com/topic/133532-script-performance/ Share on other sites More sharing options...
cooldude832 Posted November 20, 2008 Share Posted November 20, 2008 I don't see how u slowin it down all you do is get its info Try just displaying the same 25 images on a page without getimagesize part to it Quote Link to comment https://forums.phpfreaks.com/topic/133532-script-performance/#findComment-694552 Share on other sites More sharing options...
Andy-H Posted November 20, 2008 Author Share Posted November 20, 2008 I need that to filter the image format tho. Quote Link to comment https://forums.phpfreaks.com/topic/133532-script-performance/#findComment-694556 Share on other sites More sharing options...
wildteen88 Posted November 20, 2008 Share Posted November 20, 2008 The only thing I can see which can slow the script down is if the request to and from http://vle.tameside.ac.uk is slow. The code is fine tho. Quote Link to comment https://forums.phpfreaks.com/topic/133532-script-performance/#findComment-694561 Share on other sites More sharing options...
sasa Posted November 20, 2008 Share Posted November 20, 2008 can you echo $i; after for loop Quote Link to comment https://forums.phpfreaks.com/topic/133532-script-performance/#findComment-694569 Share on other sites More sharing options...
Andy-H Posted November 26, 2008 Author Share Posted November 26, 2008 3528 Sorry was at college at the time and my pc broke when I got home It was just the slow host, sorry about wasting time Quote Link to comment https://forums.phpfreaks.com/topic/133532-script-performance/#findComment-699618 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.