Current time: 03-22-2010, 08:16 AM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 3 Votes - 2.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Download] MyBB Statistics Signature
07-10-2009, 07:34 PM
Post: #21
RE: [Download] MyBB Statistics Signature
I figured I'd post this to show the possibilities of the code presented here:

[Image: ookasig.php]

LiteBulletin 1.2 is now running on our LiteSoft Forums!

http://community.litesoft.info
Find all posts by this user
Quote this message in a reply
07-10-2009, 07:51 PM
Post: #22
RE: [Download] MyBB Statistics Signature
Pretty cool. I like it.
Find all posts by this user
Quote this message in a reply
07-10-2009, 08:13 PM (This post was last modified: 07-12-2009 02:42 PM by querschlaeger.)
Post: #23
RE: [Download] MyBB Statistics Signature
Yeah, I got a cache version! Cool

PHP Code:
<?php

/**
 * MyBB Statistic Signature Variant By Ooka and querschlaeger
 */

// Here you can set some parameters
$backgroundimage='./statsig.png';
$cachefile='./cache/statsig.cache'// normally don't touch
$cachegap=600// how many seconds should cache file life?

// If no cache file exists or it't too old we have to create it
if(!file_exists($cachefile)||(time()-filemtime($cachefile))>=$cachegap){

    
// First we do the MyBB part
    
define('IN_MYBB',1);
    
define('NO_ONLINE',1);
    require_once 
'./global.php';
    
$lang->load('stats');
    
$stats=$cache->read('stats');

    
// Then we create the image
    
$img=imagecreatefrompng($backgroundimage);
    
$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,50,40,utf8_decode($mybb->settings['bbname']).' - '.$mybb->settings['bburl'],$fontcolor);
    
imagepng($img,$cachefile,9);
    
imagedestroy($img);

}

// Yeah, finally we just load the cache file and die
header('Content-type: image/png');
header('Last-Modified: '.gmdate('r',filemtime($cachefile)));
header('Expires: '.gmdate('r',time()+$cachegap));
die(
file_get_contents($cachefile));
?>

The three lines beneath Here you can set some parameters are interesting if you want to set the cache settings or the source of the background image.

Please make sure that your cache directory is writable (normally it should by MyBB default).

So, this was my part. Don't see any improvement suggestions at the moment. Ooka is the styling professional and maybe he will modify the look. Wink

Visit this user's website Find all posts by this user
Quote this message in a reply
07-10-2009, 08:33 PM
Post: #24
RE: [Download] MyBB Statistics Signature
Thanks for the code, Querschlaeger, I really appreciate it.

Cheers,
Gene

“The road to positivity is strewn with the abandoned vehicles of the faint-hearted.” Peter McWilliams
Find all posts by this user
Quote this message in a reply
07-11-2009, 01:19 AM (This post was last modified: 07-11-2009 01:21 AM by querschlaeger.)
Post: #25
RE: [Download] MyBB Statistics Signature
wow, it's also possible to use a true type font!

just use this snippet:

PHP Code:
[...]
    
// Then we create the image
    
$img=imagecreatefrompng($backgroundimage);
    
$fontcolor=imagecolorallocate($img,0,0,0);
    
imagettftext($img,11,0,10,22,$fontcolor,'./inc/captcha_fonts/MINYN___.ttf',utf8_decode($lang->members).' '.$stats['numusers']);
    
imagettftext($img,11,0,137,22,$fontcolor,'./inc/captcha_fonts/MINYN___.ttf',utf8_decode($lang->posts).' '.$stats['numposts']);
    
imagettftext($img,11,0,263,22,$fontcolor,'./inc/captcha_fonts/MINYN___.ttf',utf8_decode($lang->threads).' '.$stats['numthreads']);
    
imagettftext($img,11,0,50,50,$fontcolor,'./inc/captcha_fonts/MINYN___.ttf',utf8_decode($mybb->settings['bbname']).' - '.$mybb->settings['bburl']);
    
imagepng($img,$cachefile,9);
    
imagedestroy($img);
[...] 


Attached File(s) Thumbnail(s)
   

Visit this user's website Find all posts by this user
Quote this message in a reply
07-11-2009, 02:15 AM
Post: #26
RE: [Download] MyBB Statistics Signature
Well, I added that and it screwed up the image. Check a couple posts back to see. And I edited the file back to the way it was, re-uploaded it, and it still won't go back. :/

LiteBulletin 1.2 is now running on our LiteSoft Forums!

http://community.litesoft.info
Find all posts by this user
Quote this message in a reply
07-11-2009, 02:40 AM
Post: #27
RE: [Download] MyBB Statistics Signature
How do you make user stats on this? like for each users?

Back Somewhat.
[Image: 280574.jpg]
Visit this user's website Find all posts by this user
Quote this message in a reply
07-11-2009, 03:01 AM
Post: #28
RE: [Download] MyBB Statistics Signature
I'll start working on something for that, although querschlaeger might get to it before me. xD

LiteBulletin 1.2 is now running on our LiteSoft Forums!

http://community.litesoft.info
Find all posts by this user
Quote this message in a reply
07-11-2009, 09:53 AM
Post: #29
RE: [Download] MyBB Statistics Signature
(07-11-2009 02:40 AM)T0m Wrote:  How do you make user stats on this? like for each users?

Don't know what you mean exactly... What should be inside the image if it's a personal user signature? The posts of this user? The online time of this user? The only status? What should not stand inside if? The total posts, the threads (...)?

Visit this user's website Find all posts by this user
Quote this message in a reply
07-11-2009, 02:20 PM
Post: #30
RE: [Download] MyBB Statistics Signature
Oh yeah, please someone make that. Like posts, reputation, threads, warning and all those stuff.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: