PHP Gallery and Server Resources

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ross2376
Forum Newbie
Posts: 19
Joined: Mon May 30, 2005 12:03 am

PHP Gallery and Server Resources

Post 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
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Post 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.
Ross2376
Forum Newbie
Posts: 19
Joined: Mon May 30, 2005 12:03 am

Post 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
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Ross2376
Forum Newbie
Posts: 19
Joined: Mon May 30, 2005 12:03 am

Post by Ross2376 »

K thats what I was thinking too. Thanks alot for your help.
Post Reply