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($NewImage, 255, 255, 255);
imagestring($NewImage, 5, 20, 5, $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.