2009-07-10, 04:43 PM
2009-07-10, 04:50 PM
Oh, well then yeah, sure, we can work on a great free one.
2009-07-10, 05:47 PM
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
now nobody needs to touch the file.
just copy the the statsig.php and a statsig.png to root directory. that's all!
Next idea: Create a hard linked image in ./cache/ folder and refresh it only every hour (or so)...
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.
just copy the the statsig.php and a statsig.png to root directory. that's all!
Next idea: Create a hard linked image in ./cache/ folder and refresh it only every hour (or so)...
2009-07-10, 05:57 PM
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.
I'll update the first post with the new download.
2009-07-10, 06:02 PM
anybody else who want's to perfect this signature mod?
2009-07-10, 06:04 PM
(2009-07-10, 06:02 PM)querschlaeger Wrote: [ -> ]Someone else want's to perfect this signature mod?
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
2009-07-10, 06:08 PM
Maybe, but I have to re-read some php function manuals. Uh, I got headache some hours before...
2009-07-10, 06:21 PM
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?
2009-07-10, 06:29 PM
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.
I'm working on it.
2009-07-10, 06:33 PM
Cool. Sounds great, good luck then.