homepage Welcome to WebmasterWorld Guest from 54.235.39.132
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Can my server take the load of this thumbnail generator?
I have a .php file generate thumbnails on the fly, but is it slow?
natural number




msg:3100688
 5:01 pm on Sep 28, 2006 (gmt 0)

My server: Shared VPS
Centos 4
Equal share CPU
1GB Burst RAM
256MB RAM

My question: I have a .php file generate thumbnails on the fly. I have a moderate amount of traffic. Sometimes the gallery(s) shown can list up to 20 or so images, with fairly large thumbnails. Am I causing uneccessary server load by not just making my own thumbnails and having all these galleries generated on the fly?

 

DrDoc




msg:3100693
 5:03 pm on Sep 28, 2006 (gmt 0)

Are you creating the actual thumbnail images on the fly? If so, yes, that's a waste of resources! Pre-generate them and simply include them normally.

coopster




msg:3100726
 5:20 pm on Sep 28, 2006 (gmt 0)

You mentioned gallery ... if you are using an image upload process for your gallery you could generate the thumbnails during the image upload process once at that point rather than generate them on every page view.

freeflight2




msg:3100737
 5:29 pm on Sep 28, 2006 (gmt 0)

if you already have set it up like this just add some caching functionality to save / reuse the file on disk to it

natural number




msg:3100831
 6:32 pm on Sep 28, 2006 (gmt 0)

echo 'Automatic thumbnail generation up image upload is an excellent idea. I\'ll have to keep that in mind.';

But basically, all I'm doing is having these images being created on the fly everytime someone new comes around. It's one of these deals:

<img src="http://www.example.com/gallery.php?image=example-1.jpg?w=100">

This format of thumbnail generation is fairly common, I believe.

DrDoc




msg:3100832
 6:34 pm on Sep 28, 2006 (gmt 0)

The way the thumbnails are generated is fine ... But you should save the generated thumbnail. Then, for each request ... first see if the image exists. If it does, send that. If not, create a resized and send that.

You'll need to use:
header()
fpassthru()

natural number




msg:3100862
 6:59 pm on Sep 28, 2006 (gmt 0)

thanks Dr. Doc, I'll do that. Sounds like sound advice.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved