Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/37387-photo-gallery/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/37387-photo-gallery/#findComment-178731
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/37387-photo-gallery/#findComment-179062
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/37387-photo-gallery/#findComment-179158
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/37387-photo-gallery/#findComment-179279
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.