View Single Post
Old 05-02-2007, 04:59 PM   #11
BrainSmashR
Banned
 
BrainSmashR's Avatar
 
Join Date: Feb 2007
Location: Natchitoches
Age: 53
Posts: 1,090
Rep Power: 0 BrainSmashR will become famous soon enough
Send a message via ICQ to BrainSmashR Send a message via AIM to BrainSmashR Send a message via MSN to BrainSmashR Send a message via Yahoo to BrainSmashR
Quote:
Originally Posted by AnimeSpirit
Actually, displaying dynamic data in a GIF is very simple. I don't use one on my site for 2 reasons: 1. None of my sites have data that change so drastically throughout the day; 2. Everytime someone views a page that has such a banner on it, it must query your database for the info in order to make it, which puts a huge strain on the server when you've got that banner displayed in 100+ places and people are hitting those pages 500+ times a day.

Don't get me wrong, dynamic banners a great idea, but it's better for your server's peformance to set a script that creates this image and updates it at specific times of the day instead of everytime the banner is loaded. Set a CRON job to run your banner update script once a day and that would probably be efficient enough and won't eat your server resources alive.

Here's a simple script I wrote a while back to write a text string to an existing graphic file.
PHP Code:
$string "Some text";
$NewImage =imagecreatefromjpeg("pic.jpg");
$TextColor imagecolorallocate($NewImage255255255);
imagestring($NewImage5205$string$TextColor);
imagejpeg($NewImage); //Output image to browser or save to path 
It would be very simple to point this at an existing background image and query for some data to place in it.

If you want, let's jump to the computer forums and continue this. We can share code if you want. I've got some tricks you might like.

Yes, I agree that's better for server performance, but I prefer current information, not something that is 24 (or more) hours old.

Note the differences in these two BOINC sigs.




Well I can't display a dynamic image without utilizing a rewrite in my htaccess file and I'm not gonna do that to show something you already know about, espically when it's data from another site, but my current Eienstein@Home credit is more than 200 points higher than the signature utilizing the method you described is showing.....and that's just 1 project.
BrainSmashR is offline   Reply With Quote