News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

signature info stats [no more updates and support]

Started by sebastian, August 20, 2005, 10:42:12 PM

Previous topic - Next topic

Witte

Brilliant little script, thanks a lot Sebastian, works a treat on SMF 1,1...it also works on phpBB bpoards as well!...I'll change the image round when I get some spare time :D

a2h_

#41
OK, I'm on a new host (for a long time too) and I've decided to pick this up...

<?php

if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else
die();


$result db_query("
SELECT COUNT(session)
FROM 
{$db_prefix}log_online"__FILE____LINE__);
list ($context['users_online']) = mysql_fetch_row($result);
mysql_free_result($result);

$forum_version 'SMF 1.1.1'; //make manually changes
$img_url $settings['default_theme_url']; 
$forum_name $context['forum_name'];
$forum_url $boardurl;
$now forum_time();
$time gmdate("d-M-Y H:i:s",$now);
$timel date("d-M-Y H:i:s",$now);
$total_members $context['common_stats']['total_members'];
$total_posts $context['common_stats']['total_posts'];
$total_topics $context['common_stats']['total_topics'];
$online_members $context['users_online'];
$forum_version_png $forum_version;

$image "$img_url/images/signature_info.png"// or where you want
$im imagecreatefrompng($image); 
$green ImageColorAllocate ($im2913811); 
$blue ImageColorAllocate ($im00255); 
$red ImageColorAllocate ($im25500);
$white ImageColorAllocate ($im255255255);
$black ImageColorAllocate ($im000);
$font "./Themes/fonts/micross.ttf"// change your font path and name here

imagettftext($im1202015$blue$font"Statistics of $forum_name"); 
imagettftext($im12017430$blue$font"$forum_url");
imagettftext($im1209045$white$font"$time Greenwich Time"); 
imagettftext($im1209060$white$font"$timel Local Time");
imagettftext($im1209075$red$font"Total Members : $total_members");
imagettftext($im1209090$red$font"Online Members: $online_members");
imagettftext($im12023575$red$font"Total Posts: $total_posts");
imagettftext($im12023590$red$font"Total Topics: $total_topics");
imagettftext($im12090105$black$font"Forum Version: $forum_version_png");
 
header("Content-Type: image/png"); 
Imagepng($im,'',90);
// if PHP v5.1 ++
//Imagepng($im,'',9); 
ImageDestroy ($im); 


?>


This is not the final thing, it was done as a basic test to see if ttf works. Unfortunately the script (NOT TTFTEXT) does not work. Go here:

http://www.a2h.8m6.net/gameon/stats.php

And also look at the code, you can see that all the files I linked in the code exist.
With an underscore. Because the one without an underscore's taken.

sebastian

Have you try to add this line? Imagepng($im,'',9); instead of Imagepng($im,'',90);

a2h_

Would that be appropriate?

QuotePHP version    4.4.3
MySQL version    4.1.21-standard-log
cPanel Build    10.9.0-RELEASE 118
With an underscore. Because the one without an underscore's taken.

sebastian

YES!!! and then check the name of font, maybe is MICROSS.TTF or micross.TTF on your SERVER.
$font = "./Themes/fonts/micross.ttf"; // change your font path and name here

Tanks

#45
I tried to use this and i follwed the instructions.. it comes up as a blank page

http://www.gapeindex.dk/signature.png

I use SMF 1.1 RC3 with TP 0.9.6 [PHP Version 4.4.4]

What can i be doin wrong ? I cant even get the stats to show  :o

Edit: If i open in firefox i get this message

The image "http://www.gapeindex.dk/signature.png" cannot be displayed, because it contains errors.

sebastian


Tanks

I followed the steps in the first post of this topic

and this is the code i used

<?php

if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else
die();

signature();

function 
signature()
{
global 
$context$settings$modSettings$db_prefix$boardurl;

$result db_query("
SELECT COUNT(session)
FROM 
{$db_prefix}log_online"__FILE____LINE__);
list ($context['users_online']) = mysql_fetch_row($result);
mysql_free_result($result);

$forum_ver 'SMF ' $modSettings['smfVersion'];
$img_url $settings['default_theme_url']; 
$forum_name $context['forum_name'];
$forum_url $boardurl;
$timezone $modSettings['time_offset'];
$now forum_time();
$time gmdate("d-M-Y H:i:s",$now 3600*($timezone+date("I")));
$timel date("d-M-Y H:i:s",$now);
$total_members $context['common_stats']['total_members'];
$total_posts $context['common_stats']['total_posts'];
$total_topics $context['common_stats']['total_topics'];
$online_members $context ['users_online'];
 

$image "http://www.gapeindex.dk/images/signature.png"// or where you want
$im imagecreatefrompng($image); 
$green ImageColorAllocate ($im2312417); 
$blue ImageColorAllocate ($im00255); 
$red ImageColorAllocate ($im25500);
$white ImageColorAllocate ($im255255255);
$black ImageColorAllocate ($im000);

 
ImageString($im3101"Statistics of $forum_name"$blue); 
ImageString($im39415"$forum_url"$blue);
ImageString($im39031"$time Greenwich Time"$green); 
ImageString($im39046"$timel Local Time"$green);
ImageString($im39061"Total Members : $total_members"$red);
ImageString($im39076"Online Members: $online_members"$red);
ImageString($im322061"Total Posts: $total_posts"$red);
ImageString($im322076"Total Topics: $total_topics"$red);
ImageString($im39091"Forum Version: $forum_ver "$black);
 
header("Content-Type: image/png"); 
Imagepng($im,'',90);
// if PHP v5.1 ++
// Imagepng($im,'',9);  
ImageDestroy ($im); 
}
?>


Maybe my php is to old and dont support this ?? I dont have any coding skills so i really cant tell but im quite sure i followed all the steps in the first post.  :)

sebastian

#48
Your image http://www.gapeindex.dk/images/signature.png link did not display anything... Try another acceptable.

Create first a blank color .png file without text.


Tanks

Quote from: sebastian on March 01, 2007, 04:23:28 AM
Your image http://www.gapeindex.dk/images/signature.png link did not display anything... Try another acceptable.

Create first a blank color .png file without text.



Im not sure i understand.. that link is my blank(blue) png file i wanted to use for background... its not that one that makes problems ?

sebastian

Well i am sure knat that's your problem. Have you try another .png file?

If you have the same problem...
...open your .htaccess and remove this line AddType application/x-httpd-php .png

dumbelljunkie

How do you this with a Joomla bridge ?
SMF 1.1.2 Joomla 1.0.12 Bridge 1.1.7

sebastian

No difference dumbelljunkie... Just follow the  instructions.

dumbelljunkie

#53
Tried that in every way (first option only) but I can't get it to work..

It only shows a white screen witht he link from my signature, and a {alt} for the image.

Perhaps use a full url for the image ?
SMF 1.1.2 Joomla 1.0.12 Bridge 1.1.7

sebastian

{alt} ??? = alt="my signature"  ???

Check your script again. This script is so simple. Can you post your code?


dumbelljunkie

Perhaps simple for the one's who understand PHP ;) I'm trying to learn it but it's more difficuld than I wanted if you don't have Dutch basics... ;)
This is the code I put in the root dir:

<?php

if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else
die();

signature();

function 
signature()
{
global 
$context$settings$modSettings$db_prefix$boardurl;

$result db_query("
SELECT COUNT(session)
FROM 
{$db_prefix}log_online"__FILE____LINE__);
list ($context['users_online']) = mysql_fetch_row($result);
mysql_free_result($result);

$forum_ver 'SMF ' $modSettings['smfVersion'];
$img_url $settings['default_theme_url']; 
$forum_name $context['forum_name'];
$forum_url $boardurl;
$timezone $modSettings['time_offset'];
$now forum_time();
$time gmdate("d-M-Y H:i:s",$now 3600*($timezone+date("I")));
$timel date("d-M-Y H:i:s",$now);
$total_members $context['common_stats']['total_members'];
$total_posts $context['common_stats']['total_posts'];
$total_topics $context['common_stats']['total_topics'];
$online_members $context ['users_online'];
 

$image "$img_url/images/signature_info.png"// or where you want
$im imagecreatefrompng($image); 
$green ImageColorAllocate ($im2312417); 
$blue ImageColorAllocate ($im00255); 
$red ImageColorAllocate ($im25500);
$white ImageColorAllocate ($im255255255);
$black ImageColorAllocate ($im000);

 
ImageString($im3101"Statistics of $forum_name"$blue); 
ImageString($im39415"$forum_url"$blue);
ImageString($im39031"$time Greenwich Time"$green); 
ImageString($im39046"$timel Local Time"$green);
ImageString($im39061"Total Members : $total_members"$red);
ImageString($im39076"Online Members: $online_members"$red);
ImageString($im322061"Total Posts: $total_posts"$red);
ImageString($im322076"Total Topics: $total_topics"$red);
ImageString($im39091"Forum Version: $forum_ver "$black);
 
header("Content-Type: image/png"); 
Imagepng($im,'',90);
// if PHP v5.1 ++
// Imagepng($im,'',9);  
ImageDestroy ($im); 
}
?>


The background image is in themes/default/signature_info.png with the same name as the php. Only thing I wonder is the .htaccess, since Joomla has that and the forum doesn't anymore, should I make a new htacess for the forum, or should I add the code in the htacess at the Joomla one ?
SMF 1.1.2 Joomla 1.0.12 Bridge 1.1.7

sebastian

If exist remove this line from your .htaccess file AddType application/x-httpd-php .png then check your script.

If this problem remain check your php version and make the right changes.

php version = 4.0+ then Imagepng($im,'',90)
php version = 5.0+ then Imagepng($im,'',9)


dumbelljunkie

Removed the line from htaccess but the problemremains.



Forumversie: SMF 1.1.2 (meer details)
Huidige SMF-versie: SMF 1.1.2
PHP-versie: 4.3.11
MySQL-versie: 4.1.21-log
Serverversie: Apache/2.0.53 (Fedora)
GD-versie: bundled (2.0.28 compatible)

I don't think I can change anything to the php, my host won't allow much..
SMF 1.1.2 Joomla 1.0.12 Bridge 1.1.7

sebastian

#58
Make changes only to your signature_info.php file.
Your version is php 4 and your code is right Imagepng($im,'',90).

This link is wrong. [xxxx.xxx/forum/admin_beheer/sig.png]
The right link is xxxx.xxx/forum/signature_info.php but still not working.

You can use sig.png only if exist AddType application/x-httpd-php .png else put file with extension .php (for example signature_info.php).

Ι've no ideas what is error at the moment.

ps Open signature_info.php find Imagepng($im,'',90) and replace with Imagepng($im,'',0)

0 = no Compression



dumbelljunkie

#59
It has to be a problem with the Joomla bridge, it causes many functions to fail in smf. Perhaps the htaccess in joomla just won't allow it.

the xxxx.xxx/forum/admin_beheer/sig.png was nothing more than a screenshot to show what is wrong

the original background image is

the php is to be found in signature_info.php

Funny how the joomla bridge causes so many small issues..

Edit: I made that change Imagepng($im,'',0) but when I access signature_info.php
directly it only shows a blank screen. Without that piece of code it shows the box with the red cross meaning it can't load the image.

pff crazy IE and FF show different pages to the sig, in anycase it doesn't work. I forgot to mention the link in the profile:

[img]http://www.powerlifting-forum.nl/forum/signature_info.php[/img]
SMF 1.1.2 Joomla 1.0.12 Bridge 1.1.7

Advertisement: