jcombs_31 Posted February 7, 2007 Share Posted February 7, 2007 I've written a few small gallery scripts and want to make one that is the ONE. There are some things that I've been thinking about though. It would be nice to always deal with one image. The main image that is uploaded. The problem is, I generally like to resize images to a couple sizes to obviously limit bandwidth/disk space for thumbnails, ect. BUT, when doing this, if you upload many images at once, the execution time takes forever and some hosts limit this time, or even limit the upload size. I'm looking for some thoughts on the best way to build an interactive gallery. Quote Link to comment https://forums.phpfreaks.com/topic/37387-photo-gallery/ Share on other sites More sharing options...
.josh Posted February 7, 2007 Share Posted February 7, 2007 use js/ajax to queue the files for uploading 1 at a time? Quote Link to comment https://forums.phpfreaks.com/topic/37387-photo-gallery/#findComment-178712 Share on other sites More sharing options...
steviewdr Posted February 7, 2007 Share Posted February 7, 2007 Well not to harp on - but "gallery" does all the resizing of images. It also keep the original version of the unedited file. With the appropriate gd modules, you can change the brightness of images etc. crop, resize via an admin backend. Ok - so onto your problem: "The problem is, I generally like to resize images to a couple sizes to obviously limit bandwidth/disk space for thumbnails, ect. " So - you dont have enough storage space to store 3-4versions of thumnails? Gallery (sorry to harp on again) generates thumbnails the first time an image is viewed. These are then saved in /var/tmp - so your user disk quota is unaffected. Of course these /var/tmp files may be cleared every day/week - but it would help speed up the photo viewing. If you knew that your host wiped /var/tmp every morning at 6am - you could run a cron job at 6:10am to parse the gallery urls, generate thumbails and resave to /var/tmp. "BUT, when doing this, if you upload many images at once, the execution time takes forever and some hosts limit this time, or even limit the upload size." XP has a publish photos option. Here is it discussed for coppermine gallery: http://jcr.chu.cam.ac.uk/photoalbum/xp_publish Also - with respects to publishing/uploading images - is it you or the client that you want to cater for? Could you zip the images - and upload them via ftp? unzip and place in the folder etc? File size uploading (to exceed the 2meg limit) can be overcome with a .htaccess file (if htaccess are used/allowed). Anyhoo - just my ramblings. -steve Quote Link to comment https://forums.phpfreaks.com/topic/37387-photo-gallery/#findComment-178731 Share on other sites More sharing options...
jcombs_31 Posted February 7, 2007 Author Share Posted February 7, 2007 I'm catering to the user, not myself, even though I am also considered a user, but a more advanced one. What is the point in regenerating thumbnails every day? Doesn't make sense to me. My problem wasn't disk space, it was the fact that I"m storing so many different versions of 1 image. I guess I was thinking along the lines of generating a thumbail in real time, but I assume the page render would then take longer for the script to execute. I'm just thinking out loud of the best way to create a gallery script. Quote Link to comment https://forums.phpfreaks.com/topic/37387-photo-gallery/#findComment-179062 Share on other sites More sharing options...
ober Posted February 7, 2007 Share Posted February 7, 2007 I don't know Jeff... I looked long and hard when I thought about writing my own, and I landed on http://gallery.menalto.com/ It does everything I think you'd ever really want, and to reproduce what it does with it's efficiency would be very hard and VERY time consuming. I normally like to build stuff myself, but I took the "why reinvent the wheel" approach on this one. Either way, I think the most efficient way would be to store several different versions of the file. Doing all that manipulation in realtime would be too time consuming. Another issue you'll run into is the upload limits. I had to put a modified php.ini file in the base directory to overcome it. It would be nice if that was a setting in the admin panel that you could automatically generate those settings files. Quote Link to comment https://forums.phpfreaks.com/topic/37387-photo-gallery/#findComment-179158 Share on other sites More sharing options...
steviewdr Posted February 7, 2007 Share Posted February 7, 2007 I'm catering to the user, not myself, even though I am also considered a user, but a more advanced one. What is the point in regenerating thumbnails every day? Doesn't make sense to me. My problem wasn't disk space, it was the fact that I"m storing so many different versions of 1 image. I guess I was thinking along the lines of generating a thumbail in real time, but I assume the page render would then take longer for the script to execute. I'm just thinking out loud of the best way to create a gallery script. Ah! - I though you had disk space limits. Whats your problem with storing multiple versions of 1 photo? You can cache/save the resized thumbnails in a /home/user/public_html/photos/thumbs1temp When calling a thumbnail - check if a thumbnail exists in the temp folder - if it does - great serve it off. If not use gd to resize and save into a temp folder for next time. Im with Ober on this one however - i.e. gallery doing everything. Ober: I have also noticed that bots can hammer it a bit, and I have had to tweak the performance/caching settings for mysql queries to 1 day. -steve Quote Link to comment https://forums.phpfreaks.com/topic/37387-photo-gallery/#findComment-179279 Share on other sites More sharing options...
ober Posted February 7, 2007 Share Posted February 7, 2007 Mine doesn't get used that much, and it's not part of my main site, so I haven't had the bot issues. Quote Link to comment https://forums.phpfreaks.com/topic/37387-photo-gallery/#findComment-179287 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.