Page 1 of 1

PHP Gallery and Server Resources

Posted: Sun Jun 04, 2006 2:28 am
by Ross2376
Hello,

I was wondering if some of you guys that have developed galleries or know some stuff about resources would help me out here. I have developed a gallery that displays 9 thumbnails for each page. Now, I have added the option to add a dropshadow to the pic but I am wanting to do it "on-demand" to eliminate the need to save original pics and shadowed pics combined (and a couple other reasons). Now my question and concern: Do you guys think shadowing 9 pics (about 10K in size each...thumbs) would be intensive on the CPU and memory. I'm not thinking it will be memory intensive (considering a 10K image isnt all that big uncompressed..and I make sure to clean up each image after its shadowed and outputted) but I am worried about the CPU usage. Currently the server I have going has a 2.6 P4 and 1024 RAM. Also, when someone clicks a thumb, it opens a large image in a new window I am wanting to shadow that on demand, but considering that is about a 50K image, I wouldn't think that would be a problem just doing it by itself and not all at once.

Please let me know what you guys think and if you wouldn't mind, some suggestions on what I should do. Also, if anyone knows of a good way to check how much cpu load a script creates, sharing that would be much appreciated.

Thanks,

Ross

Posted: Sun Jun 04, 2006 4:57 am
by matthijs
Couldn't you just use a background-image (in css) with a shadow for each image? That way, you'll have only 1 extra small image that must be downloaded. Once downloaded it's cached in the browsers cache. Also, you can always change the kind of shadow easily by changing the image. I don't know how you made your gallery html (tables, divs, li) but it shouldn't be too difficult.

Posted: Sun Jun 04, 2006 8:07 am
by Ross2376
Hmm I neve thought about that. That is a thought too. I will look into that. Ok, another question: Would resizing images on the fly be to intensive? The script is designed to sllow option between small medium and large and was just wanting to resize 1 image instead of saving multiples. If this can be done an easier way, please let me know.

Thanks for your response mathijs

Posted: Sun Jun 04, 2006 8:16 am
by s.dot
My initial thought is yes, that would be too intensive. A common way of doing this is saving the pictures in the 3 different sizes. pic_s pic_m pic_l

Of course this takes up more space, but in anyones opinion.. CPU is a lot more precious than space. So if you're going to waste one.. waste the space. :-P

Posted: Sun Jun 04, 2006 9:41 am
by Ross2376
K thats what I was thinking too. Thanks alot for your help.