Thanks for the ideas. I think I will let some trash build up on the server for now, and do a garbage collector in the future. I am planning a "hits" function in the future, so I could always record the time when the latest hit was, and clear out all images that haven't been hit in the past month.
Chris: "Catch the missing files when requested (either in Apache via mod_rewrite, or Joomla's 404 handler) and redirect to your thumbnail creation handler. This script should generate the file and write it to your thumbnail URL, then redirect back to the assigned thumbnail URL." I think it would be easier just to do a if(!file_exisits) as I write the html, and make the image then, rather than write the html, then check if the image exists when it is requested. The software has to work on hundreds of servers, so I try to avoid any apache mod_rewrite stuff, of 404 redirects, as it tends to put my support through the roof. "you don't say why the images will need remaking regularly" I didn't explain what I meant by "on the fly" very well. In this case I meant making the images with something like php thumbs/custom script (<img src="php_thumbs.php?src=X&width=Y...) and then caching that output stream to some kind of sesion var. In theory this way is great, as there isn't the whole messy 'what files are left on the server' problem, because no files where created. Of course the downside is cpu going through the roof. That was idea #2. I think my idea number #3 was what you thought I meant, which is more a file caching system, rather than a memory caching system. On Jan 11, 10:59 am, chris burgess <[email protected]> wrote: > Reference the thumbnail URL in your HTML as though it exists already. > > Catch the missing files when requested (either in Apache via mod_rewrite, or > Joomla's 404 handler) and redirect to your thumbnail creation handler. > > This script should generate the file and write it to your thumbnail URL, > then redirect back to the assigned thumbnail URL. > > Your thumbnails will be built as they are viewed, which means that unviewed > thumbnails don't place any load on the system. You can batch-build them at > offpeak hours simply by requesting them (wget -m oughta do it). > > Also, > > On Mon, Jan 11, 2010 at 9:37 AM, matt_thomson <[email protected]> wrote: > > 2.) Make the images on the fly, and try some kind of caching method. > > * Problem, even with some kind of caching, the gallery images are still > > going to be have to remade quite regularly (the gallery will run on > > other customers servers, so only php caching is an option).* Ideally I > > want the user to make a gallery, have the images made, then have the > > images downloaded for a month. Not have the gallery made, then have > > the images remade 5,000 times over the next month (slowing down the > > server). > > ... you don't say why the images will need remaking regularly? If this is > because updated images are supplied over time, then you need to purge (only) > those matches from the cache when an image is updated. They will then be > rebuilt when next viewed.
-- NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected]
