jmag Posted March 29, 2006 Share Posted March 29, 2006 Hello,I've got a small script that when a folder is entered it looks for thumbnails, if there aren't any they are created. so for each folder it's only being done once. However, sometimes a folder can contain up to a hundred highres photos, and my development can't quite handle that amount of data since the PHP engine seems to be sending a new pic for resizing and writing to the disc faster than the computer can do each image.Now my Q is this: is there any way to tell the phpscript to send an image, wait till it's done, then do next? just to make sure the server can handle everything without crashing/rebooting even if there are lots of images. I got a strong guess that this also would increase the perfomance of the script since it won't try to do everything and then choke.the script can be viewed here if necessary: [a href=\"http://www.rafb.net/paste/results/62AqLi91.html\" target=\"_blank\"]http://www.rafb.net/paste/results/62AqLi91.html[/a]Thanx in advance for any help! Quote Link to comment https://forums.phpfreaks.com/topic/6125-creating-heaps-of-thumbs-in-a-go/ Share on other sites More sharing options...
jmag Posted April 1, 2006 Author Share Posted April 1, 2006 *bump*anyone? Quote Link to comment https://forums.phpfreaks.com/topic/6125-creating-heaps-of-thumbs-in-a-go/#findComment-22843 Share on other sites More sharing options...
redbullmarky Posted April 1, 2006 Share Posted April 1, 2006 [!--quoteo(post=359795:date=Mar 29 2006, 09:19 PM:name=jmag)--][div class=\'quotetop\']QUOTE(jmag @ Mar 29 2006, 09:19 PM) [snapback]359795[/snapback][/div][div class=\'quotemain\'][!--quotec--]Hello,I've got a small script that when a folder is entered it looks for thumbnails, if there aren't any they are created. so for each folder it's only being done once. However, sometimes a folder can contain up to a hundred highres photos, and my development can't quite handle that amount of data since the PHP engine seems to be sending a new pic for resizing and writing to the disc faster than the computer can do each image.Now my Q is this: is there any way to tell the phpscript to send an image, wait till it's done, then do next? just to make sure the server can handle everything without crashing/rebooting even if there are lots of images. I got a strong guess that this also would increase the perfomance of the script since it won't try to do everything and then choke.the script can be viewed here if necessary: [a href=\"http://www.rafb.net/paste/results/62AqLi91.html\" target=\"_blank\"]http://www.rafb.net/paste/results/62AqLi91.html[/a]Thanx in advance for any help![/quote]as far as i know, you don't need to wait. problems with the images being written would indicate a problem with your script further than than (eg file formats and using the right imagejpeg/imagegif/imagepng, etc).might be worth checking this. also note that if, as you're creating the thumbnails you're putting them straight out on the screen, that a script can only send the headers and output one image at a time. Quote Link to comment https://forums.phpfreaks.com/topic/6125-creating-heaps-of-thumbs-in-a-go/#findComment-22848 Share on other sites More sharing options...
kenrbnsn Posted April 1, 2006 Share Posted April 1, 2006 Your script may be taking more than the default 30 seconds to run, just increase the amount of time by calling the function [a href=\"http://www.php.net/set_time_limit\" target=\"_blank\"]set_time_limit[/a]().Ken Quote Link to comment https://forums.phpfreaks.com/topic/6125-creating-heaps-of-thumbs-in-a-go/#findComment-22889 Share on other sites More sharing options...
bqallover Posted April 1, 2006 Share Posted April 1, 2006 I'm working on a (messy!) gallery script at the moment and I've found that generating the thumbnails dynamically each time someone views the page is far too time-consuming. I'm using imagecopyresample, no imagecopyresize, so that explains the time-taking. My solution was to create a 'thumbs' directory in the gallery directory and when a file is uploaded, create the thumbnail then and put it in the thumbs directory. Then just 'img src' images in that directory with links to the high-res images. This is working well for me. Quote Link to comment https://forums.phpfreaks.com/topic/6125-creating-heaps-of-thumbs-in-a-go/#findComment-22898 Share on other sites More sharing options...
jmag Posted April 4, 2006 Author Share Posted April 4, 2006 Thanx for all tips and answers. However, the files are written to the disc, so a thumb is only created once and then just shown with <img src... />My problem isn't when they are just supposed to be shown, the problem is that first time someone enters a directory and thums are created and written to the disc. I know my server isn't very powerful (amd1800+, 256mb ram), but being a development server it's just some old stuff put together. But even still there should be some way to make it que all thumbs to be created so it doesn't sort of choke. Or perhaps it's a server config I should make?I guess that depending on the size of the files, the limit is somewhere around 20-30 pics in one dir. More than that it crashes and reboots.Here's a new link to the code since the old one expired: [a href=\"http://www.rafb.net/paste/results/ah7NdK82.html\" target=\"_blank\"]http://www.rafb.net/paste/results/ah7NdK82.html[/a]thanx alot. Quote Link to comment https://forums.phpfreaks.com/topic/6125-creating-heaps-of-thumbs-in-a-go/#findComment-23735 Share on other sites More sharing options...
cssmatt Posted April 4, 2006 Share Posted April 4, 2006 I think i am having the same problem, in that i create a thumbnail of a larger picture by calling a thumbnail generator script, by passing a path to it. And then it outputs the picture to screen. This process is looped untill all thumbs are displayed.Although only the first 9 or 10 are ever all displayed correctly. After that the odd one or two are broekn links.Would i benefit from extending the set_time_limit() or is my problem related to the server not being fast enough??More detail here: [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=90020\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=90020[/a] Quote Link to comment https://forums.phpfreaks.com/topic/6125-creating-heaps-of-thumbs-in-a-go/#findComment-23767 Share on other sites More sharing options...
jmag Posted April 4, 2006 Author Share Posted April 4, 2006 this is pretty much exactly the same as I do and same problem, although it never displays incorrectly after what I've noticed.The thing is I'm not exatly sure that my server is the problem, it's just a guess...but still, anyone? any more hints/tips? Quote Link to comment https://forums.phpfreaks.com/topic/6125-creating-heaps-of-thumbs-in-a-go/#findComment-23860 Share on other sites More sharing options...
kenrbnsn Posted April 4, 2006 Share Posted April 4, 2006 Have you tried to extend the execution time like I mentioned a few posts back? If you use a zero for the argument, it gives you unlimitied execution time. I have made similar thumbnail scripts and I have to increase the execution time if I want them to complete.Ken Quote Link to comment https://forums.phpfreaks.com/topic/6125-creating-heaps-of-thumbs-in-a-go/#findComment-23908 Share on other sites More sharing options...
cssmatt Posted April 4, 2006 Share Posted April 4, 2006 Ive tried using set_time_limit() by setting it to 0, also by leaving it blank, but it doesnt seem to have an effect?!Ive also tried max_execution_time(), which also doesnt have any effect?! I notice on pp.net that it says, set_time_limit only has an effect on the script itself, and not external activites, would loading an image class as an external activity, as i notice that database queries are?!?!Could this be the problem, if so, any work arounds?! Quote Link to comment https://forums.phpfreaks.com/topic/6125-creating-heaps-of-thumbs-in-a-go/#findComment-23978 Share on other sites More sharing options...
litebearer Posted April 5, 2006 Share Posted April 5, 2006 Just out of curiosity (frequently paraphrased by S. Holmes and Lt Columbo)....[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]I've got a small script that when a folder is entered it looks for thumbnails, if there aren't any they are created. so for each folder it's only being done once. However, sometimes a folder can contain up to a hundred highres photos[/quote]In what manner/fashion/method are the pictures originally being placed into the folders?Lite... Quote Link to comment https://forums.phpfreaks.com/topic/6125-creating-heaps-of-thumbs-in-a-go/#findComment-24025 Share on other sites More sharing options...
jmag Posted April 7, 2006 Author Share Posted April 7, 2006 sry for the late reply, been away for a couple of days...anyhoot, the files are just copied over via windowsexplorer or whatever other may be suitable. It isn't an upload script or anything, it just scans a folder for pictures and, if there are, it looks for the same filename with the prefix "tn_", if that doesn't exist it creates the thumbnail and write it to the disc.this is where there problem occurs, depending on the size of the pictures it may vary how many it can handle before it crashes. it's just a loop, and it seems like it chokes on all pictures being sent for resizing...just tell me if you want to take a look at the code, I'll post it again at nopaste... easier to read the code there and the post here won't be as long.cheers! Quote Link to comment https://forums.phpfreaks.com/topic/6125-creating-heaps-of-thumbs-in-a-go/#findComment-24899 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.