MyBB Community Forums
[Download] MyBB Statistics Signature - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Releases (https://community.mybb.com/forum-102.html)
+---- Thread: [Download] MyBB Statistics Signature (/thread-52673.html)

Pages: 1 2 3 4 5 6 7


RE: [Download] MyBB Statistics Signature - querschlaeger - 2009-07-10

Hm no, I don't want any credit...


RE: [Download] MyBB Statistics Signature - Eric - 2009-07-10

Oh, well then yeah, sure, we can work on a great free one. Wink


RE: [Download] MyBB Statistics Signature - querschlaeger - 2009-07-10

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


RE: [Download] MyBB Statistics Signature - Eric - 2009-07-10

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


RE: [Download] MyBB Statistics Signature - querschlaeger - 2009-07-10

anybody else who want's to perfect this signature mod? Smile


RE: [Download] MyBB Statistics Signature - Gene53 - 2009-07-10

(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


RE: [Download] MyBB Statistics Signature - querschlaeger - 2009-07-10

Maybe, but I have to re-read some php function manuals. Uh, I got headache some hours before...


RE: [Download] MyBB Statistics Signature - faviouz - 2009-07-10

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?


RE: [Download] MyBB Statistics Signature - querschlaeger - 2009-07-10

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


RE: [Download] MyBB Statistics Signature - faviouz - 2009-07-10

Cool. Sounds great, good luck then.