Thread Rating:
  • 6 Vote(s) - 2.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Download] MyBB Statistics Signature
#11
Hm no, I don't want any credit...
Reply
#12
Oh, well then yeah, sure, we can work on a great free one. Wink
Reply
#13
Ok,

first, I replaced all language strings and db queries with mybb internal functions. so it make use of the mybb cache and it is language neutral.
Also I add a special header that allows browsers to cache the file:

statsig.php
<?php
define('IN_MYBB',1);
define('NO_ONLINE',1);
require_once './global.php';
$lang->load('stats');
$stats=$cache->read('stats');

header('Content-type: image/png');
header('Last-Modified: Sat, 26 Jul 1997 05:00:00 GMT'); // really this is a hard caching method...

$img = imageCreateFromPNG('statsig.png');
$fontcolor = ImageColorAllocate ($img, 0, 0, 0);

ImageString ($img, 2, 15, 10, utf8_decode($lang->members).' '.$stats['numusers'], $fontcolor);
ImageString ($img, 2, 135, 10, utf8_decode($lang->posts).' '.$stats['numposts'], $fontcolor);
ImageString ($img, 2, 255, 10, utf8_decode($lang->threads).' '.$stats['numthreads'], $fontcolor);
ImageString ($img, 2, 80, 40, utf8_decode($mybb->settings['bbname']).' - '.$mybb->settings['bburl'], $fontcolor);

ImagePng ($img);
ImageDestroy ($img);
?>

now nobody needs to touch the file. Exclamation

just copy the the statsig.php and a statsig.png to root directory. that's all! Big Grin

Next idea: Create a hard linked image in ./cache/ folder and refresh it only every hour (or so)... Shy
Reply
#14
Nice, thanks for the help, I just modified it a bit so the link is centered.

I'll update the first post with the new download. Wink
Reply
#15
anybody else who want's to perfect this signature mod? Smile
Reply
#16
(2009-07-10, 06:02 PM)querschlaeger Wrote: Someone else want's to perfect this signature mod? Smile

Quote:Create a hard linked image in ./cache/ folder and refresh it only every hour (or so)

Is this something you'll implement?

Cheers,
Gene
“The road to positivity is strewn with the abandoned vehicles of the faint-hearted.” Peter McWilliams
Reply
#17
Maybe, but I have to re-read some php function manuals. Uh, I got headache some hours before...
Reply
#18
Quote:Create a hard linked image in ./cache/ folder and refresh it only every hour (or so)
I don't get it :| What does this do?
Reply
#19
It will create a file (the signature image) in cache folder and load it to browser directly if it exsits. This will improve the image loading time and reduces the server load severely.

I'm working on it. Toungue
Reply
#20
Cool. Sounds great, good luck then.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)