So ...
New vision (Oct 12, 2007) - One man show signature
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsign_tl.gif&hash=a2f37ad6560284c089a98f64b43741a7755ae1ad) | (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsign_tr.gif&hash=c81f4add3f0eeb605d52cbd74f0ba7ba8a80526e) |
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsign_bl.gif&hash=cf140d04b989585b49f7601de80f364d63aa1782) | (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsign_br.gif&hash=54b7a6f2070c79beca575a19987d5acd1ad89081) |
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsign_arcl.gif&hash=7d920fe2ad8e23f70c14ea697f07a43947544ef3) | (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsign_arcr.gif&hash=acef6f7069c9a0ea166cc838dd8f710edee6164b) |
Get the code here (http://www.simplemachines.org/community/index.php?topic=46408.msg1271553#msg1271553)
Arcade last 4 games + scores + position only (http://www.simplemachines.org/community/index.php?topic=46408.120)
arcade last games thumbnails or scores + position (http://www.simplemachines.org/community/index.php?topic=46408.msg1280432#msg1280432)
SMF Shop -> money (http://www.simplemachines.org/community/index.php?topic=46408.msg1275537#msg1275537)
access as [img]http://www.mydomain.com/sign.php?u=x[/img]
http://www.mydomain.com/sign.php?u=xu=x -> user IDor[img]http://www.mydomain.com/sign.png?u=x[/img]
http://www.mydomain.com/sign.png?u=xu=x -> user IDby adding 2 lines into your
.htaccess file.
RewriteEngine On
RewriteRule sign.png sign.php If the file
sign.php is inside the folder
/forum then
.htaccess must be...
RewriteEngine On
RewriteRule sign.png /forum/sign.php Clasic signature info stats-----------------------
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsign2007.gif&hash=7b3a12113bed36281d1251da7e26ba664f0eed14) | (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsignfont2007.gif&hash=b37f18d425474c65c81aee51c517b160e6e11394) |
-----------------------------------
First case
no use font (left image)
STEP 1
make a file, for example
signature_info.php and copy this file into root path of SMF installation.
{full code below}STEP 2
copy an image for background, for example this image (right click/save as image) --> (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsignature_info.png&hash=4c42c9fc45e0f8523fcf8f413bbbc276aa7e1a45) into
/Themes/Default/images path
STEP 3
Goto your profile settings and set this text into your signature area ->
[img]http://my.forum.url.com/signature_info.php[/img]
for example ->
[img]http://www.iamsmfuser.com/signature_info.php[/img]
Finally set your signature -->
[img]http://mydomain/signinfo.png[/img]
[/center]
signature_info.php NO_FONTS (SMF 1.1.x)
<?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);
$img_url = $settings['default_theme_url'];
$forum_name = $context['forum_name'];
$forum_url = $boardurl;
$now = forum_time();
$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'];
$last_member = $context['common_stats']['latest_member']['name'];
$image = "$img_url/images/signature_info.png"; // or where you want
$im = imagecreatefrompng($image);
if (!$im)
{
$im = imagecreatetruecolor(385, 110); // x-coordinate, y-coordinate
//default is black but if you want another background color uncheck
//imagefill($im, 0, 0, 255, 0, 0); // red etc
}
$green = ImageColorAllocate ($im, 23, 124, 17);
$blue = ImageColorAllocate ($im, 0, 0, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
ImageString($im, 3, 10, 1, "$forum_name", $blue);
ImageString($im, 3, 94, 15, "$forum_url", $blue);
ImageString($im, 3, 90, 31, "$timel Local Time", $green);
ImageString($im, 3, 90, 46, "Total Members : $total_members", $red);
ImageString($im, 3, 90, 61, "Online Members: $online_members", $red);
ImageString($im, 3, 220, 61, "Total Posts: $total_posts", $red);
ImageString($im, 3, 220, 46, "Total Topics: $total_topics", $red);
ImageString($im, 3, 90, 76, "Latest Member: $last_member ", $red);
$php = PHP_VERSION;
header("Content-Type: image/png");
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($im,null,9,null);
}
else {
Imagepng($im,null,90,null);
}
ImageDestroy ($im);
}
?>
signature_info.php NO_FONTS (SMF 2.x.x)
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else
die();
signature();
function signature()
{
global $smcFunc, $context, $settings, $modSettings, $boardurl;
$request = $smcFunc['db_query']('', '
SELECT count(session)
FROM {db_prefix}log_online
',
array()
);
list ($context['num_users_online']) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$img_url = $settings['default_theme_url'];
$forum_name = $context['forum_name'];
$forum_url = $boardurl;
$now = forum_time();
$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['num_users_online'];
$last_member = $context['common_stats']['latest_member']['name'];
$image = "$img_url/images/signature_info.png"; // or where you want
$im = imagecreatefrompng($image);
if (!$im)
{
$im = imagecreatetruecolor(385, 110); // x-coordinate, y-coordinate
//default is black but if you want another background color uncheck
//imagefill($im, 0, 0, 255, 0, 0); // red etc
}
$green = ImageColorAllocate ($im, 23, 124, 17);
$blue = ImageColorAllocate ($im, 0, 0, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
ImageString($im, 3, 10, 1, "$forum_name", $blue);
ImageString($im, 3, 94, 15, "$forum_url", $blue);
ImageString($im, 3, 90, 31, "$timel Local Time", $green);
ImageString($im, 3, 90, 46, "Total Members : $total_members", $red);
ImageString($im, 3, 90, 61, "Online Members: $online_members", $red);
ImageString($im, 3, 220, 61, "Total Posts: $total_posts", $red);
ImageString($im, 3, 220, 46, "Total Topics: $total_topics", $red);
ImageString($im, 3, 90, 76, "Latest Member: $last_member ", $red);
$php = PHP_VERSION;
header("Content-Type: image/png");
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($im,null,9,null);
}
else {
Imagepng($im,null,9,null);
}
ImageDestroy ($im);
}
?>
----------------------------------------------------------------------------------------------------------------------------------
Second case
use font (right image)
STEP 1 STEP 2 STEP 3 is the same with first case
STEP 4
Make a folder
/fonts in the same path of
/Themes or where you want but change this from
signature_info.php below
copy into folder
/fonts a font file (ttf), for example
arial.ttf or
MTCORSVA.TTF (Monotype Corsiva) or other font but change the name and path from
signature_info.php file below.
signature_info.php use font (SMF 1.1.x)
<?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, $boarddir;
$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);
$img_url = $settings['default_theme_url'];
$forum_name = $context['forum_name'];
$forum_url = $boardurl;
$now = forum_time();
$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'];
$last_member = $context['common_stats']['latest_member']['name'];
$image = "$img_url/images/signature_info.png"; // or where you want
$im = imagecreatefrompng($image);
if (!$im)
{
$im = imagecreatetruecolor(385, 110); // x-coordinate, y-coordinate
//default is black but if you want another background color uncheck
//imagefill($im, 0, 0, 255, 0, 0); // red etc
}
$green = ImageColorAllocate ($im, 23, 124, 17);
$blue = ImageColorAllocate ($im, 0, 0, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
$font = $boarddir .'/fonts/arial.ttf'; // change your font path and name here
imagettftext($im, 12, 0, 10, 15, $blue, $font, "$forum_name");
imagettftext($im, 12, 0, 94, 31, $blue, $font, "$forum_url");
imagettftext($im, 12, 0, 90, 46, $green, $font, "$timel Local Time");
imagettftext($im, 12, 0, 90, 61, $red, $font, "Total Members : $total_members");
imagettftext($im, 12, 0, 90, 76, $red, $font, "Online Members: $online_members");
imagettftext($im, 12, 0, 220, 76, $red, $font, "Total Posts: $total_posts");
imagettftext($im, 12, 0, 220, 61, $red, $font, "Total Topics: $total_topics");
imagettftext($im, 12, 0, 90, 91, $red, $font, "Latest Member: $last_member ");
$php = PHP_VERSION;
header("Content-Type: image/png");
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($im,null,9,null);
}
else {
Imagepng($im,null,9,null);
}
ImageDestroy ($im);
}
?>
signature_info.php use font (SMF 2.x.x)
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else
die();
signature();
function signature()
{
global $smcFunc, $context, $settings, $modSettings, $boardurl, $boarddir;
$request = $smcFunc['db_query']('', '
SELECT count(session)
FROM {db_prefix}log_online
',
array()
);
list ($context['num_users_online']) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$img_url = $settings['default_theme_url'];
$forum_name = $context['forum_name'];
$forum_url = $boardurl;
$now = forum_time();
$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'];
$last_member = $context['common_stats']['latest_member']['name'];
$image = "$img_url/images/signature_info.png"; // or where you want
$im = imagecreatefrompng($image);
if (!$im)
{
$im = imagecreatetruecolor(385, 110); // x-coordinate, y-coordinate
//default is black but if you want another background color uncheck
//imagefill($im, 0, 0, 255, 0, 0); // red etc
}
$green = ImageColorAllocate ($im, 23, 124, 17);
$blue = ImageColorAllocate ($im, 0, 0, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
$font = $boarddir .'/fonts/arial.ttf'; // change your font path and name here
imagettftext($im, 12, 0, 10, 15, $blue, $font, "$forum_name");
imagettftext($im, 12, 0, 94, 31, $blue, $font, "$forum_url");
imagettftext($im, 12, 0, 90, 46, $green, $font, "$timel Local Time");
imagettftext($im, 12, 0, 90, 61, $red, $font, "Total Members : $total_members");
imagettftext($im, 12, 0, 90, 76, $red, $font, "Online Members: $online_members");
imagettftext($im, 12, 0, 220, 76, $red, $font, "Total Posts: $total_posts");
imagettftext($im, 12, 0, 220, 61, $red, $font, "Total Topics: $total_topics");
imagettftext($im, 12, 0, 90, 91, $red, $font, "Latest Member: $last_member ");
$php = PHP_VERSION;
header("Content-Type: image/png");
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($im,null,9,null);
}
else {
Imagepng($im,null,9,null);
}
ImageDestroy ($im);
}
?>
I did a few changes so it fits mine better:
<?php
require(dirname(__FILE__) . '/SSI.php');
$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 Beta 3 Public'; //make manually changes
$forum_name = $context['forum_name'];
$forum_url = $boardurl;
$now = forum_time();
$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'];
$latest_member = $context['common_stats']['latest_member'];
$image = "http://www.******.com/Themes/default/images/800%20by%20180.jpg"; // or where you want
$im = imagecreatefrompng($image);
$green = ImageColorAllocate ($im, 23, 124, 17);
$blue = ImageColorAllocate ($im, 0, 0, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
ImageString($im, 3, 10, 1, "Statistics of $forum_name", $blue);
ImageString($im, 3, 94, 15, "$forum_url", $blue);
ImageString($im, 3, 90, 31, "latest_member", $green);
ImageString($im, 3, 90, 61, "Total Members : $total_members", $red);
ImageString($im, 3, 90, 76, "Online Members: $online_members", $red);
ImageString($im, 3, 220, 61, "Total Posts: $total_posts", $red);
ImageString($im, 3, 220, 76, "Total Topics: $total_topics", $red);
ImageString($im, 3, 90, 91, "Forum Version: $forum_version ", $black);
header("Content-Type: image/png");
Imagepng($im,'',100);
ImageDestroy ($im);
?>
Please help me!
and I havn't edited the SSI.php....
help you with what? I don't see no question or error message in your post... ::)
Oh sorry, well when I go to reply mode and write:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.%2A%2A%2A%2A%2A.com%2Fsignature_info.php&hash=8ebdce142c86e6a9e370c9b568c865e9dd290aa6)
and press preview, it doesn't show any image :(
Also if I go to: http://www.*****.com/signature_info.php
it says: The image "http://www.*****.com/signature_info.php" cannot be displayed, because it contains errors.
What errors Snickers?
Quote
$image = "http://www.******.com/Themes/default/images/800%20by%20180.jpg"; // or where you want
<---- Yours modification
MUST BE PNG FILE TO WORK PROPERLY because you call this file by
header("Content-Type: image/png");
Nice tip, thanks for sharing.
Hi, I've got a quick question for this...
I went through and edited everything and it seems to be working all right, but my Total Members, Total Posts, Total Topics, and Latest Member sections show up blank. The Online Members section works fine though, oddly.
Here's a example...
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Feohjay.net%2Fsmf%2Fsignature_info.php&hash=33cac32ef13e57e94cdeffdc147942d0db942d1d)
I have a feeling I'm missing something fairly obvious, can I get any help please?
mine won't show the latest member, but I haven't added any of this... strange.
Quote from: eohjay on November 05, 2005, 05:06:36 AM
Hi, I've got a quick question for this...
I went through and edited everything and it seems to be working all right, but my Total Members, Total Posts, Total Topics, and Latest Member sections show up blank. The Online Members section works fine though, oddly.
Here's a example...
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Feohjay.net%2Fsmf%2Fsignature_info.php&hash=33cac32ef13e57e94cdeffdc147942d0db942d1d)
I have a feeling I'm missing something fairly obvious, can I get any help please?
Same here...
eohjay or CKnetworX can you post your php code of "signature_info.php"? This tip is very easy to work properly.
ps Tested only with SMF 1.1 beta 3 and SMF 1.1 RC1
Now Snickers and Sting this is wrong --> ImageString($im, 3, 90, 31, "latest_member", $green);
Replace with this -> ImageString($im, 3, 90, 31, "latest_member : $latest_member", $green);
I have this signature_info.php working on my own forums, however, when I try to use it as a signature in another forum website, it does not work. These other websites are phpbb websites.
any ideas?
thanks....
I get a blank screen
http://atlantis.montecarlohosting.net/~arksvr/forum/signature_info.php
spottedhog i haven't tried it in any phpbb forum, normally it can work anywhere.
Well, doesn's work. I suppose it will work only with a mod to deactivate some default features of phpbb2.
Try this --->
open your
.htaccess ADD this line
AddType application/x-httpd-php .pngthen rename your .php file to .png file... For example signinfo.php to signinfo.png...
Finally set your signature
[img]http://mydomain/signinfo.png[/img]
ArkServer i thing there's something wrong with your ssi.php and signature_info.php file.
Quoteif (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else
die();
If you have PHP v5.1++ try this
Imagepng($im,'',9)
instead
Imagepng($im,'',90)
is this available for version 1.1 rc2?
Yes, is very simple script.
Quote from: sebastian on July 09, 2006, 07:39:43 AM
Yes, is very simple script.
do i just use the code in the first post?
Yes SurfExcelerator!
Indeed very lovely , thanks for sharing .
I tried this but no stats are showing...
This is all that shows -->
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg502.imageshack.us%2Fimg502%2F9480%2Funtitledgc2.png&hash=9251b85f1bd38f7393df18faacb738194af27a2d)
I'm using version 1.1 RC2.
Can someone help?
How do I make the entire image a hyperlink? Oh, and I almost forgot to say without using actual linking tags. I want the linking code to be in the php signature info file... possible?
Surf--- try an image file that has more height and less width. As you can see from my sig, I resized everything to make it fit. And yes, I removed some items to make it space out ok.
For Chucky and spottedhog (older post about forum who do not accept .php link as signature)
open your .htaccess ADD this line AddType application/x-httpd-php .png
then rename your .php file to .png file... For example signinfo.php to signinfo.png...
Finally set your signature --> [img]http://mydomain/signinfo.png[/img]
Thanks!!! I had long forgotten about it..... I will try it!
thanks again!
Latest member wasnt working for me, so i changed
$latest_member = $context['common_stats']['latest_member'];
to
$latest_member = $context['common_stats']['latest_member']['name'];
I tried to add the font the same way the topic starter did but it still looked the same...
<?php
$img_number = imagecreate(150,25);
$backcolor = imagecolorallocate($img_number,0,0,0);
$textcolor = imagecolorallocate($img_number,255,255,255);
$font = "fonts/cour.ttf"; // change your font path and name here
imagefill($img_number,0,0,$backcolor);
$number = "$_SERVER[REMOTE_ADDR]";
Imagestring($img_number,10,5,5,$number,$textcolor);
header("Content-type: image/gif");
imagegif($img_number);
?>
My font is Courier New, in http://rctxtremegamez.aonservers.com/forum/fonts/cour.ttf
It's not the same.
Check your script syndax again.
Quoteimagestring ( resource image, int font, int x, int y, string s, int col )
http://php.net/imagestring Try to use 1,2,3,4 or 5 no 10
10? How would that be Courier New? PHP is so confusing....
Did you try putting in the absolute path to your font file?
Try this ...
Quote<?php
$im = imagecreatetruecolor(130,30);
$white = ImageColorAllocate ($im, 255, 255, 255);
$font = "fonts/cour.ttf"; // change your font path and name here
$number = "$_SERVER[REMOTE_ADDR]";
imagettftext($im, 12, 0, 20, 20, $white, $font, $number);
header("Content-Type: image/png");
Imagepng($im,'',9);
ImageDestroy ($im);
?>
Doesn't work, just gives me an image 4 pixels wide. Go to my forum http://www.rctxtremegamez.aonservers.com/forum/ (http://www.rctxtremegamez.aonservers.com/forum/) and look at the section 'Your user IP has been logged'.
If you have PHP version 4.0+ then Imagepng($im,'',90); otherwise if your php version is 5.0 + then Imagepng($im,'',9);
It work fine. http://www.rctxtremegamez.aonservers.com/forum/userip.php
.... does not exist any problem.
Fatal error: Call to undefined function: imagettftext() in /home/rctxtrem/public_html/forum/userip.php on line 8
rctxtreme this is impossible
yesterday your little script it was well.
Check all elements of imagettftext() again.
or copy-past this script here.
No, yesterday I used the old script that I started with
http://php.net/manual/en/function.imagettftext.php#61227
http://www.tomrafteryit.net/authimage-error-call-to-undefined-function-imagettftext/
Αccording to these sites:
Those errors indicate that your PHP installation does not have True Type Font support compiled.
The guy that owns my webhost is like 'use <font>'... omfgwtf...
Forget true type fonts ... Get GDfonts...
like this Your IP (http://www.remorse.gr/gdfont/gdfont.php)
Download Courier GDfont (http://www.remorse.gr/gdfont/Courier.gdf)
<?php
header("Content-type: image/png");
$im = imagecreatetruecolor(290, 18);
$black = imagecolorallocate($im, 0, 0, 0);
$white = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 0, 0, 49, 19, $black);
$font = imageloadfont("Courier.gdf");
$number = "$_SERVER[REMOTE_ADDR]";
imagestring($im, $font, 10, 0, "Your IP adress is:$number", $white);
imagepng($im);
?>
It works, thanks, now I just need to wait for TP 0.9.5
Thanks just what i was looking for
Worked like a charm for me! Thanks! I even added some database calls for numbers which update daily. Check out my signature.
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
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 ($im, 29, 138, 11);
$blue = ImageColorAllocate ($im, 0, 0, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
$font = "./Themes/fonts/micross.ttf"; // change your font path and name here
imagettftext($im, 12, 0, 20, 15, $blue, $font, "Statistics of $forum_name");
imagettftext($im, 12, 0, 174, 30, $blue, $font, "$forum_url");
imagettftext($im, 12, 0, 90, 45, $white, $font, "$time Greenwich Time");
imagettftext($im, 12, 0, 90, 60, $white, $font, "$timel Local Time");
imagettftext($im, 12, 0, 90, 75, $red, $font, "Total Members : $total_members");
imagettftext($im, 12, 0, 90, 90, $red, $font, "Online Members: $online_members");
imagettftext($im, 12, 0, 235, 75, $red, $font, "Total Posts: $total_posts");
imagettftext($im, 12, 0, 235, 90, $red, $font, "Total Topics: $total_topics");
imagettftext($im, 12, 0, 90, 105, $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.
Have you try to add this line? Imagepng($im,'',9);
instead of Imagepng($im,'',90);
Would that be appropriate?
QuotePHP version 4.4.3
MySQL version 4.1.21-standard-log
cPanel Build 10.9.0-RELEASE 118
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
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.
Can you post your code?
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 ($im, 23, 124, 17);
$blue = ImageColorAllocate ($im, 0, 0, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
ImageString($im, 3, 10, 1, "Statistics of $forum_name", $blue);
ImageString($im, 3, 94, 15, "$forum_url", $blue);
ImageString($im, 3, 90, 31, "$time Greenwich Time", $green);
ImageString($im, 3, 90, 46, "$timel Local Time", $green);
ImageString($im, 3, 90, 61, "Total Members : $total_members", $red);
ImageString($im, 3, 90, 76, "Online Members: $online_members", $red);
ImageString($im, 3, 220, 61, "Total Posts: $total_posts", $red);
ImageString($im, 3, 220, 76, "Total Topics: $total_topics", $red);
ImageString($im, 3, 90, 91, "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. :)
Your image http://www.gapeindex.dk/images/signature.png (http://www.gapeindex.dk/images/signature.png) link did not display anything... Try another acceptable.
Create first a blank color .png file without text.
Quote from: sebastian on March 01, 2007, 04:23:28 AM
Your image http://www.gapeindex.dk/images/signature.png (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 ?
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
How do you this with a Joomla bridge ?
No difference dumbelljunkie... Just follow the instructions.
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 ?
{alt} ??? = alt="my signature" ???
Check your script again. This script is so simple. Can you post your code?
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 ($im, 23, 124, 17);
$blue = ImageColorAllocate ($im, 0, 0, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
ImageString($im, 3, 10, 1, "Statistics of $forum_name", $blue);
ImageString($im, 3, 94, 15, "$forum_url", $blue);
ImageString($im, 3, 90, 31, "$time Greenwich Time", $green);
ImageString($im, 3, 90, 46, "$timel Local Time", $green);
ImageString($im, 3, 90, 61, "Total Members : $total_members", $red);
ImageString($im, 3, 90, 76, "Online Members: $online_members", $red);
ImageString($im, 3, 220, 61, "Total Posts: $total_posts", $red);
ImageString($im, 3, 220, 76, "Total Topics: $total_topics", $red);
ImageString($im, 3, 90, 91, "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 ?
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)
Removed the line from htaccess but the problemremains.
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.powerlifting-forum.nl%2Fforum%2Fadmin_beheer%2Fsig.png&hash=a3725e683c4e00116b26b0bd1e45633cbde812c4)
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..
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
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 (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.powerlifting-forum.nl%2Fforum%2FThemes%2Fdefault%2Fimages%2Fsignature_info.png&hash=042623de438a9fb0c8dd77f608e797203bdf12af)
the php is to be found in signature_info.php (http://www.powerlifting-forum.nl/forum/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 (http://www.powerlifting-forum.nl/forum/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]
Yes dumbelljunkie, have you try this -> Imagepng($im,'',0) ?
I need help. How would I add Latest member to right under the Online Members. Can you edit the following code to make it work like that. :)
Thanks.
Brianjw
<?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 ($im, 23, 124, 17);
$blue = ImageColorAllocate ($im, 0, 0, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
ImageString($im, 3, 90, 1, "$forum_url", $blue);
ImageString($im, 3, 90, 15, "$time Greenwich Time", $green);
ImageString($im, 3, 90, 31, "$timel Local Time", $green);
ImageString($im, 3, 90, 46, "Total Members : $total_members", $red);
ImageString($im, 3, 90, 61, "Online Members: $online_members", $red);
ImageString($im, 3, 230, 46, "Total Posts: $total_posts", $red);
ImageString($im, 3, 230, 61, "Total Topics: $total_topics", $red);
ImageString($im, 3, 90, 76, "Forum Version: $forum_ver ", $black);
header("Content-Type: image/png");
Imagepng($im,'',90);
// if PHP v5.1 ++
// Imagepng($im,'',9);
ImageDestroy ($im);
}
?>
EDIT: Also it says my smf version is 1.1.2 instead of 1.1.3 and what is Greenwich time?
EDIT2: Changed code.
Hello brianjw
Just add, modify & delete some lines...
$last_member = $context['common_stats']['latest_member']['name'];
ImageString($im, 3, 90, 76, "Latest Member: $last_member ", $red);
REPLACE
//$forum_ver = 'SMF ' . $modSettings['smfVersion'];
WITH
$forum_ver = 'SMF 1.1.3'; //manual changes
REPLACE
ImageString($im, 3, 90, 76, "Forum Version: $forum_ver ", $black);
WITH
ImageString($im, 3, 90, 91, "Forum Version: $forum_ver ", $black);
DELETE
$timezone = $modSettings['time_offset'];
$time = gmdate("d-M-Y H:i:s",$now - 3600*($timezone+date("I")));
ImageString($im, 3, 90, 15, "$time Greenwich Time", $green);
Finally
<?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'];
$forum_ver = 'SMF 1.1.3'; //manual changes
$img_url = $settings['default_theme_url'];
$forum_name = $context['forum_name'];
$forum_url = $boardurl;
$now = forum_time();
$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'];
$last_member = $context['common_stats']['latest_member']['name'];
$image = "$img_url/images/signature_info.png"; // or where you want
$im = imagecreatefrompng($image);
$green = ImageColorAllocate ($im, 23, 124, 17);
$blue = ImageColorAllocate ($im, 0, 0, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
ImageString($im, 3, 90, 1, "$forum_url", $blue);
ImageString($im, 3, 90, 31, "$timel Local Time", $green);
ImageString($im, 3, 90, 46, "Total Members : $total_members", $red);
ImageString($im, 3, 90, 61, "Online Members: $online_members", $red);
ImageString($im, 3, 230, 46, "Total Posts: $total_posts", $red);
ImageString($im, 3, 230, 61, "Total Topics: $total_topics", $red);
ImageString($im, 3, 90, 76, "Latest Member: $last_member ", $red);
ImageString($im, 3, 90, 91, "Forum Version: $forum_ver ", $black);
header("Content-Type: image/png");
Imagepng($im,'',90);
// if PHP v5.1 ++
//Imagepng($im,'',9);
ImageDestroy ($im);
}
?>
Thanks. As you can see:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.brianjwilson.com%2Fsignature_info.php&hash=a8a7cb46e9c61ccb954f6d21ef9f44c5c167c28f)
All is working well.
However, I did not make the manual edit for the version problem because I am thinking there has to be some other way. Somehow some file didn't get updated and I want to fix the file so it works and updates without a manual edit each time I upgrade. Any ideas where to go? SSI.php maybe? Wherever the code
$modSettings['smfVersion'] is being called would be the place to go I think. :)
Brianjw
EDIT: Another few questions.
- Can I make the local timezones time appear as am/pm time instead of military time?
- What was the point of Greenwich time to be in the code, what was it's purpous?
I agree with you that 'SMF Version' is a weakness. However the definition of SMF Version becomes manually (index.php => $forum_version = 'SMF 1.1.3') and is being called as global variable.
This script is based on SSI.php which does not load this variable ($forum_version).
QuoteCan I make the local timezones time appear as am/pm time instead of military time?
$timel = date("d-M-Y g:i:s a",$now);
QuoteWhat was the point of Greenwich time to be in the code, what was it's purpous?
Not necessary. Delete this line.
Great mod, but a couple of questions:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.ruthlessintent.com%2Fsiginfo.php&hash=a3f7bea4583c80cb4639b5938dc8cde9b55828ba)
What code do I use to replace blue with yellow?
How can I make it so that there is a space in between Total members and Total topics?
@sebastian: Thanks for all your help. I tried to replace that timezone space so I tried adding Total Boards. I used the following codes:
$total_boards = $context['common_stats']['total_boards'];
ImageString($im, 3, 90, 61, "Total Boards: $total_boards", $red);
However it doesn't appear. Any ideas? (see signature)
@L.G.S: To replace the color blue with yellow you have to edit the following codes in the main file.
Find:
ImageString($im, 3, 10, 1, "$forum_name", $blue);
ImageString($im, 3, 94, 15, "$forum_url", $blue);
Replace:
ImageString($im, 3, 10, 1, "$forum_name", $yellow);
ImageString($im, 3, 94, 15, "$forum_url", $yellow);
Depending on the size of the space you have by the image width you descide. But for starters try some stuff below:
Find:
220
Replace with:
230
(make it a larger number for bigger space/make it smaller number for less space)
You may also try moving it over a little for more space...
Find: (note: you will have to manually find some of them as you can't find all this at once)
ImageString($im, 3, 94, 15, "$forum_url", $blue);
ImageString($im, 3, 90, 31, "$timel Local Time", $green);
ImageString($im, 3, 90, 46, "Total Members : $total_members", $red);
ImageString($im, 3, 90, 61, "Online Members: $online_members", $red);
ImageString($im, 3, 90, 76, "Latest Member: $last_member ", $red);
Replace with:
ImageString($im, 3, 89, 15, "$forum_url", $blue);
ImageString($im, 3, 85, 31, "$timel Local Time", $green);
ImageString($im, 3, 85, 46, "Total Members : $total_members", $red);
ImageString($im, 3, 85, 61, "Online Members: $online_members", $red);
ImageString($im, 3, 85, 76, "Latest Member: $last_member ", $red);
Hope this helps :)
Brianjw
Thanks, all worked except the colour change.
I presume I need to add a new line which would have an altered version of this, but I don't know the code:
$white = ImageColorAllocate ($im, 255, 255, 255);
Probably just need to edit the numbers but not sure to what.
L.G.S
Yellow Color
$yellow = ImageColorAllocate ($im, 255, 204, 51);
brianjw
Total Boards
$result = db_query("
SELECT COUNT(*)
FROM {$db_prefix}boards AS b", __FILE__, __LINE__);
list ($context['num_boards']) = mysql_fetch_row($result);
mysql_free_result($result);
$total_boards = $context['num_boards'];
Thanks it works. Also I was able to add a categories code by doing this:
$result = db_query("
SELECT COUNT(*)
FROM {$db_prefix}categories AS b", __FILE__, __LINE__);
list ($context['num_categories']) = mysql_fetch_row($result);
mysql_free_result($result);
$total_cats = $context['num_categories'];
;) Brianjw
Perfectly ;)
I got some problems...
I've tried changing all the placement code but I can't seem to get what I want.
See this here:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.ruthlessintent.com%2Fpainsig.php&hash=5802baf680f92c47d6d3832e9c80e6ea575763f2)
I'd like all the text under my link to be moved over to the left more so all the stats show, and then moved down a little so they aren't covering the circle graphic as much.
Can that be done?
Just play with x-coordinate, y-coordinate.
example
ImageString($im, 3, 10, 1, "$forum_name", $blue);
ImageString($im, 3, 94, 31, "$forum_url", $blue);
ImageString($im, 3, 30, 46, "$timel Local Time", $green);
ImageString($im, 3, 30, 61, "Total Members : $total_members", $red);
ImageString($im, 3, 30, 76, "Online Members: $online_members", $red);
ImageString($im, 3, 160, 76, "Total Posts: $total_posts", $red);
ImageString($im, 3, 160, 61, "Total Topics: $total_topics", $red);
ImageString($im, 3, 30, 91, "Latest Member: $last_member ", $red);
which ones are he x and y?
Quotewhich ones are he x and y?
ImageString($im, 3,
30,
91, "Latest Member: $last_member ", $red);
30 = x
91 = y
I just started getting internal server error on
http://www.brianjwilson.com/signature_info.php
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.brianjwilson.com%2Fsignature_info.php&hash=a8a7cb46e9c61ccb954f6d21ef9f44c5c167c28f)
so it shows up broken. I recently installed Flashchat integration if that might do anything. Flashchat integration modifies SSI.php so...
Any ideas?
Quote from: brianjw on August 09, 2007, 01:07:54 PM
I recently installed Flashchat integration if that might do anything. Flashchat integration modifies SSI.php so...
I don't think so ... Its a server problem 500. Check your
error_log file for errors about
signature_info.php.
I use godaddy and am not sure where to see the error log?
Via ftp client check your SMF FORUM folder.
File error_log.
Quote from: sebastian on August 09, 2007, 07:44:01 PM
Via ftp client check your SMF FORUM folder.
File error_log.
I don't seem to have that file.
Well brianjw, we need informations about what caused this error because the Internal Server Error - 500 is very generic message.
Your rest site work properly without Internal Server Error? There are several reports about this fault.
If yes the solution : Having problems with mod_security? (http://www.simplemachines.org/community/index.php?topic=34270.0)
... or no ...
1. Check again signature_info.php file permitions.
2. Try to upload a new signature info stats.
3. Try to run a simple hello.php file.
<?php echo 'hello'; ?>
The signature_info.php file permissions are set to 644.
Uploaded a new one, still internal server error.
I believe most servers will log a 500 error in the
error_log file.
Quote from: brianjw on August 09, 2007, 01:07:54 PM
I recently installed Flashchat integration if that might do anything. Flashchat integration modifies SSI.php so...
What permition does SSI.php file have now?
Make a backup of .htaccess file and try this : Having problems with mod_security? (http://www.simplemachines.org/community/index.php?topic=34270.0)
It didn't work either. :(
Maybe I should attach SSI.php... any other files I should maybe attach that signature_info.php needs?
Brianjw
I don't understand what going on here...
Quote from: sebastian on August 10, 2007, 12:17:58 AM
...we need informations about what caused this error because the Internal Server Error - 500 is very generic message.
Actually we need an error log file.
Please try to run two more things:
1 . a simple
hello.php file.
<?php echo 'hello'; ?>
2.
no2.php<?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);
}
?>
Quote from: sebastian on August 10, 2007, 07:16:42 PM
I don't understand what going on here...
Quote from: sebastian on August 10, 2007, 12:17:58 AM
...we need informations about what caused this error because the Internal Server Error - 500 is very generic message.
Actually we need an error log file.
Please try to run two more things:
1 . a simple hello.php file.
<?php echo 'hello'; ?>
2. no2.php
<?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);
}
?>
I am confused on what you want me to do with running php files.
Can you explain a little more in detail?
We try to locate the point of code that causes this problem.
I know but what goes in the hello.php and more detail?
Sorry I am no coder :(
Sorry to double post but since I think signature_info.php requires SSI.php this maybe what is causing it
http://www.simplemachines.org/community/index.php?topic=188328.0
I posted this. ;)
Quote from: brianjw on August 11, 2007, 05:58:42 PM
... I think signature_info.php requires SSI.php this maybe what is causing it
...Did you check this with the original SSI.php?
I can not simulate this server internal error, probably there is a problem between HTTP headers and your shared Web hosting. I am not sure. Goddady's linux hosting plans do not support non-parsed headers...
So forget
hello.php, run only
no2.php which is without any header, just for verification.
I will check the original ssi.php in the morning.
Ok. Well I have emailed godaddy for this help with this as well.
How do I run it. Like go to it directly on my website. And do I upload the code into a file called no2.php and upload it over and run it?
Thanks,
Yes, like this http://www.brianjwilson.com/no2.php
Don't forget webserver's error log.
Quote from: sebastian on August 12, 2007, 06:50:30 AM
Yes, like this http://www.brianjwilson.com/no2.php
Don't forget webserver's error log.
Ok. I will do that now.
Also this is the email I received by godaddy about the webserver error log.
Quote
Dear Brian,
Thank you for contacting online support.
I do apologize for any inconvenience this may have caused, unfortunately with the current hosting plan you are on you are unable to access the error logs for your hosting account. If you would like to have access to the logs, you will need to upgrade your account to include CGI.
You can upgrade or downgrade your hosting plan(s) from within your customer account.
To upgrade or downgrade your hosting:
• Log in to your Account Manager.
• Select Web Hosting & Databases from the Hosting & Email menu at the top of the page.
• Click the hosting plan you wish to upgrade or downgrade.
• Click Upgrade/Downgrade Hosting Account.
• Select the new hosting account type you wish to have.
• Follow the on-screen prompts to complete the process.
NOTE: If you are upgrading to a hosting plan that has a higher monthly cost than the one you are currently using, you will be charged the difference in price between what you have already paid and the cost of the new type of hosting purchased for the same period of time. If you downgrade to a hosting plan that has a lower monthly cost, the hosting plan will be extended by the number of months that could be purchased using the difference in cost.
Please let us know if we can help you in any other way.
Regards,
Robbie P
Online Support
I will see what I can upgrade to some time today...
EDITno2.php gives an internal server error as well.
So, CGI is a extra feature.
Quote from: brianjw on August 12, 2007, 09:16:26 AM
no2.php gives an internal server error as well.
You are right. SSI.php its the problem.
I posted my SSI.php in the link below. Can you search it and maybe compare it to SMF's original?
Thanks.
Quote from: brianjw on August 11, 2007, 05:58:42 PM
http://www.simplemachines.org/community/index.php?topic=188328.0 (http://www.simplemachines.org/community/index.php?topic=188328.0)
(this link opens in the same window)
Another test. Disable some lines.
1. Open SSI.php
2. Go to line 59
Just and this //
from
require_once($sourcedir . '/Subs-Seo4SMF.php');
to
// require_once($sourcedir . '/Subs-Seo4SMF.php');
3. Go to line 710-763
Before // --- Begin FlashChat integration ---
add this /*
After // --- End FlashChat integration ---
add this */
/*
// --- Begin FlashChat integration ---
*
*
*
*
*
// --- End FlashChat integration ---
*/
I did exactly as you said but it seems to still be giving an internal server error. I think we're getting somewhere though!
I guess we need to find all the mods that I don't have installed out of there.
Quote from: brianjw on August 13, 2007, 12:13:09 PM
I guess we need to find all the mods that I don't have installed out of there.
First remove or disable SEO4SMF completely.
...we need an error log file.
I have removed both codes and mods completely! The errorlog is unaccessible until I have money to switch hosts which I don't have now. We just need to keep fooling around with stuff (making backups).
Ok brianjw.
Man is this complicated.
This must be a full time job :)
My problem is this:
Fatal error: Call to undefined function: imagecreatefrompng() in /home/gctim/public_html/signature_info.php on line 33
I am not using the PNG .htaccess thing because it is messing with the rest of my .PNG files.
My current signature_info.php
<?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, $boarddir;
$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);
$img_url = $settings['default_theme_url'];
$forum_name = $context['forum_name'];
$forum_url = $boardurl;
$now = forum_time();
$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'];
$last_member = $context['common_stats']['latest_member']['name'];
$image = "/images/gcsig_info.png"; // or where you want
$im = imagecreatefrompng($image);
$green = ImageColorAllocate ($im, 23, 124, 17);
$blue = ImageColorAllocate ($im, 0, 0, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
$font = $boarddir .'/fonts/gunplay.ttf'; // change your font path and name here
imagettftext($im, 12, 0, 10, 15, $blue, $font, "$forum_name");
imagettftext($im, 12, 0, 94, 31, $blue, $font, "$forum_url");
imagettftext($im, 12, 0, 90, 46, $green, $font, "$timel Local Time");
imagettftext($im, 12, 0, 90, 61, $red, $font, "Total Members : $total_members");
imagettftext($im, 12, 0, 90, 76, $red, $font, "Online Members: $online_members");
imagettftext($im, 12, 0, 220, 76, $red, $font, "Total Posts: $total_posts");
imagettftext($im, 12, 0, 220, 61, $red, $font, "Total Topics: $total_topics");
imagettftext($im, 12, 0, 90, 91, $red, $font, "Latest Member: $last_member ");
$php = PHP_VERSION;
header("Content-Type: image/png");
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($im,'',9);
}
else {
Imagepng($im,'',90);
}
ImageDestroy ($im);
}
?>
My file locations:
http://www.glitcherscorner.com/signature_info.php
http://www.glitcherscorner.com/images/gcsig_info.png
My .htaccess is blank.
PHP version 4.4.7
What is wrong? :S
I have tried changing
$im = imagecreatefrompng($image);
to
$im = @imagecreatefrompng($image);
but then it only displays a blank page and the img does not show up anywhere. Whats wrong?
This is a GD Library problem. Perhaps GD library is not installed on your server. Check your GD Library.
Admin/Support and Credits/
Support Information
.
.
.
GD version: bundled (2.0.34 compatible) <-- For Example
I was afraid of this :(
I use to have GD on my old server, but i recently switched over. I might have to go and install it later today. Thank you for a fast reply.
What about my problem lol?
...also ssi_examples.php (http://www.brianjwilson.com/ssi_examples.php) gives the same internal error but ssi_examples.shtml (http://www.brianjwilson.com/ssi_examples.shtml) works properly.
hmmmm i don't know.
Well subastian, just to let you know, I got the past problems solved. ^
I have a paid.or.free request for you if possible. Using functions from smf and some custom mods. How would
Quote
I would love to use a signature thing on my website. I have modified my gamer card and would like it to do something like this:
-Where it says '-Username Here-' it actually displays the members display name (not username).
-Where it says 'Rep' put the total karma (whatever option is set in admin panel) of that member.
-Where it says 'Posts' put the number of posts the member has made on the website.
-Where it says 'Gender' put the image for the male or the female.
-Where it says '-Latest 4 Arcade Games Played-' Put the latest 4 games that the member has played.
-Where you see that avatar, put the members avatar. If they have no avatar display an image that says No Avatar and that goes with the colors of the sig.
It looks like this.
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.gamerzgarage.com%2Fcard.png&hash=76c1655ac5491a4a6f2bf2010d3d15933cf6b62a)
I am willing to pay for this. I would also like this private for my site at the time being
Let me know what you can do with this.
I also would like this sig to be added to their signature automatically when they register and they can take it off if they want. ;)
Also it would be awesome if members could access there signature like this - http://www.gamerzgarage.com/sig.php?u=1 (id)
THANKS SO MUCH :)
Brianjw
Hi, brianjw.
You have really great ideas. A couple of thinks first.
I dont want money. I will try to do this tip but this does not guarantee any good result or how long will it take. Also i would like this free for all people.
Conclusion: search also other solutions.
Sounds good :)!
Also do you think you can help me make the image above a little cleaner and nicer.
Example: Copy
sign.png & noavatar.png into default image folder.
Themes/default/images/Make a file. For example:
sign.php sign.php &
ssi.php -> Same Path.
Access signature as
access as [img]http://www.mydomain.com/sign.php?u=x[/img]
http://www.mydomain.com/sign.php?u=xu=x -> user ID// Your settings +++++++++++++++++++++++++++++++++++
$backimg = "$img_url/images/sign.png"; // or where you want
$noavatar = "$img_url/images/noavatar.png"; // or where you want
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
$set_gender_style = 0; // 0 text , 1 image
$set_gender_height = -92; //move gender up/down
$set_gender_width = -230; //move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++
demo here (http://www.simplemachines.org/community/index.php?topic=46408.msg332615#msg332615)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsign.png&hash=f57ef6b447baeee03a694dc3d06a6db8506b2b5e) | (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fnoavatar.png&hash=6f5faa20a85a48c88e0683233c38ae432e5bc214) |
For SMF 1.1.x<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else die();
getinfos();
signature();
function getinfos()
{
global $context, $db_prefix, $memberContext;
$mommy = '';
if ($_GET['u'] >= 1)
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : die();
else die();
$result = db_query("
SELECT memberName
FROM {$db_prefix}members
WHERE ID_MEMBER = " . (int) $id_mem . "
AND is_activated = 1
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result) > 0)
{
$mprofile[] = (int) $id_mem;
loadMemberData($mprofile, false, 'profile');
foreach ($mprofile as $profile)
{
loadMemberContext($profile);
}
$context['item_comms'] = array();
$context['item_comms'][] = array(
'lbuser' => $memberContext[$id_mem]
);
foreach ($context['item_comms'] as $item_comm)
{
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
}
} else die();
$mommy = isset($context['avatar']) ? $context['avatar'] : '';
$mommy = preg_split('/;/',$mommy, -1, PREG_SPLIT_OFFSET_CAPTURE);
$mommy = $mommy [1][0];
$mommy = trim(substr(strrchr($mommy, '='), 1));
$result2 = db_query("
SELECT filename
FROM {$db_prefix}attachments
WHERE ID_ATTACH = " . (int) $mommy . "
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result2) > 0)
{
$context['avatar_sign_id'] = array();
while ($row_items = mysql_fetch_assoc($result2))
{
$context['avatar_sign_id'][] = array(
'filename' => $row_items['filename']
);
}
foreach ($context['avatar_sign_id'] as $avatar_item)
{
$context['filename_avatar'] = $avatar_item['filename'];
}
}
unset($mommy);
mysql_free_result($result);
mysql_free_result($result2);
}
function signature()
{
global $context, $settings, $modSettings, $db_prefix;
$lemo = '';
$img_url = $settings['default_theme_url'];
$membername = $context['membername'];
$posts = $context['posts'];
if ($context['filename_avatar'] != '')
{
$lemo = $context['filename_avatar'];
}
else {
$lemo = '';
}
$avatar = $context['avatar'];
$gender = $context['gender'];
if (preg_match( '/Male/', $gender))
{
$gender = "male";
$img_gender = "$img_url/images/Male.gif";
}
elseif (preg_match( '/Female/', $gender)) {
$gender = "female";
$img_gender = "$img_url/images/Female.gif"; }
else {$gender = "n/a"; $img_gender = "$img_url/images/star.gif";}
$karmaBad = $context['karmaBad'];
$karmaGood = $context['karmaGood'];
if ($modSettings['karmaMode'] == '1')
{
$karma = $karmaGood - $karmaBad;
} elseif ($modSettings['karmaMode'] == '2')
{
$karma = '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif ($modSettings['karmaMode'] == '0')
{
$karma = 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++
$backimg = "$img_url/images/sign.png"; // or where you want
$noavatar = "$img_url/images/noavatar.png"; // or where you want
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
$set_gender_style = 0; // 0 text , 1 image
$set_gender_height = -92; //move gender up/down
$set_gender_width = -230; //move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++
if ($avatar != '') {$avatar = $avatar;}
else {$avatar = $noavatar;}
if ($lemo != '') { $ext = substr(strrchr($lemo, '.'), 1); }
else {$ext = substr(strrchr($avatar, '.'), 1);}
unset($lemo);
if ($ext == 'png') {$img_bgr = imagecreatefrompng($avatar); }
elseif ($ext == 'jpg') {$img_bgr = imagecreatefromjpeg($avatar); }
elseif ($ext == 'gif') {$img_bgr = imagecreatefromgif($avatar); }
else die();
$size = getimagesize($backimg);
if ($set_gender_style == 1) {
$img_bgr_gender = imagecreatefromgif($img_gender);
$image_width_gender = imagesx($img_bgr_gender);
$image_height_gender = imagesy($img_bgr_gender);
$dest_x_gender = $size[0] - $image_width_gender + $set_gender_width;
$dest_y_gender = $size[1] - $image_height_gender + $set_gender_height;
}
$image_width = imagesx($img_bgr);
$image_height = imagesy($img_bgr);
//______________avatar width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
{
$set_avatar_width = $set_avatar_width + (($image_width - 101) * 0.35);
$set_avatar_height = $set_avatar_height + (($image_height - 101) * 0.35);
}
else { die();}
$image = imagecreatetruecolor($image_width, $image_height);
$image = imagecreatefrompng($backimg);
$dest_x = $size[0] - $image_width + $set_avatar_width;
$dest_y = $size[1] - $image_height + $set_avatar_height;
imagecopymerge($image, $img_bgr, $dest_x, $dest_y, 0, 0, $image_width, $image_height, 100);
if ($set_gender_style == 1) {
imagecopymerge($image, $img_bgr_gender, $dest_x_gender, $dest_y_gender, 0, 0, $image_width_gender, $image_height_gender, 100);
}
$green = ImageColorAllocate ($image, 23, 124, 17);
$blue = ImageColorAllocate ($image, 0, 0, 255);
$red = ImageColorAllocate ($image, 255, 0, 0);
$white = ImageColorAllocate ($image, 255, 255, 255);
$black = ImageColorAllocate ($image, 0, 0, 0);
ImageString($image, 4, 20, 35, "Posts: $posts", $black);
ImageString($image, 4, 20, 51, "Karma: $karma", $black);
if ($set_gender_style == 0) {
ImageString($image, 5, 31, 4, "$membername", $black);
ImageString($image, 4, 20, 66, "Genter: $gender", $black);
} else {ImageString($image, 5, 44, 4, "$membername", $black);}
header("Content-Type: image/png");
$php = PHP_VERSION;
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($image,null,9,null);
}
else {
Imagepng($image,null,90,null);
}
ImageDestroy ($image);
ImageDestroy ($img_bgr);
}
?>
For SMF 2.x.x<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else die();
getinfos();
signature();
function getinfos()
{
global $smcFunc, $context, $memberContext;
$mommy = '';
if ($_GET['u'] >= 1)
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : die();
else die();
$result = $smcFunc['db_query']('', '
SELECT member_name
FROM {db_prefix}members
WHERE id_member = '. (int) $id_mem.' AND is_activated = 1
LIMIT 1
',
array()
);
if ($smcFunc['db_fetch_row']($result) > 0)
{
$mprofile[] = (int) $id_mem;
loadMemberData($mprofile, false, 'profile');
foreach ($mprofile as $profile)
{
loadMemberContext($profile);
}
$context['item_comms'] = array();
$context['item_comms'][] = array(
'lbuser' => $memberContext[$id_mem]
);
foreach ($context['item_comms'] as $item_comm)
{
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
}
} else die();
if (!empty($context['avatar']))
{
$mommy = !empty($context['avatar']) ? $context['avatar'] : '';
$mommy = preg_split('/;/',$mommy, -1, PREG_SPLIT_OFFSET_CAPTURE);
$mommy = $mommy [1][0];
$mommy = trim(substr(strrchr($mommy, '='), 1));
$result2 = $smcFunc['db_query']('','
SELECT filename
FROM {db_prefix}attachments
WHERE id_attach = ' . (int) $mommy . ' AND attachment_type = 0 AND approved = 1
LIMIT 1',
array()
);
list($count_result) = $smcFunc['db_fetch_row']($result2);
$context['filename_avatar'] = $count_result;
$smcFunc['db_free_result']($result2);
}
$smcFunc['db_free_result']($result);
}
function signature()
{
global $context, $settings, $modSettings;
$lemo = '';
$img_url = $settings['default_theme_url'];
$membername = $context['membername'];
$posts = $context['posts'];
if (!empty($context['filename_avatar']))
{
$lemo = $context['filename_avatar'];
}
else {
$lemo = '';
}
$avatar = $context['avatar'];
$gender = $context['gender'];
if (preg_match( '/Male/', $gender))
{
$gender = "male";
$img_gender = "$img_url/images/Male.gif";
}
elseif (preg_match( '/Female/', $gender)) {
$gender = "female";
$img_gender = "$img_url/images/Female.gif"; }
else {$gender = "n/a"; $img_gender = "$img_url/images/star.gif";}
$karmaBad = $context['karmaBad'];
$karmaGood = $context['karmaGood'];
if ($modSettings['karmaMode'] == '1')
{
$karma = $karmaGood - $karmaBad;
} elseif ($modSettings['karmaMode'] == '2')
{
$karma = '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif ($modSettings['karmaMode'] == '0')
{
$karma = 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++
$backimg = "$img_url/images/sign.png"; // or where you want
$noavatar = "$img_url/images/noavatar.png"; // or where you want
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
$set_gender_style = 0; // 0 text , 1 image
$set_gender_height = -92; //move gender up/down
$set_gender_width = -230; //move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++
if (!empty($avatar)) {$avatar = $avatar;}
else {$avatar = $noavatar;}
if (!empty($lemo)) { $ext = substr(strrchr($lemo, '.'), 1); }
else {$ext = substr(strrchr($avatar, '.'), 1);}
unset($lemo);
if ($ext == 'png') {$img_bgr = imagecreatefrompng($avatar); }
elseif ($ext == 'jpg') {$img_bgr = imagecreatefromjpeg($avatar); }
elseif ($ext == 'gif') {$img_bgr = imagecreatefromgif($avatar); }
else die();
$size = getimagesize($backimg);
if ($set_gender_style == 1) {
$img_bgr_gender = imagecreatefromgif($img_gender);
$image_width_gender = imagesx($img_bgr_gender);
$image_height_gender = imagesy($img_bgr_gender);
$dest_x_gender = $size[0] - $image_width_gender + $set_gender_width;
$dest_y_gender = $size[1] - $image_height_gender + $set_gender_height;
}
$image_width = imagesx($img_bgr);
$image_height = imagesy($img_bgr);
//______________avatar width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
{
$set_avatar_width = $set_avatar_width + (($image_width - 101) * 0.35);
$set_avatar_height = $set_avatar_height + (($image_height - 101) * 0.35);
}
else { die();}
$image = imagecreatetruecolor($image_width, $image_height);
$image = imagecreatefrompng($backimg);
$dest_x = $size[0] - $image_width + $set_avatar_width;
$dest_y = $size[1] - $image_height + $set_avatar_height;
imagecopymerge($image, $img_bgr, $dest_x, $dest_y, 0, 0, $image_width, $image_height, 100);
if ($set_gender_style == 1) {
imagecopymerge($image, $img_bgr_gender, $dest_x_gender, $dest_y_gender, 0, 0, $image_width_gender, $image_height_gender, 100);
}
$green = ImageColorAllocate ($image, 23, 124, 17);
$blue = ImageColorAllocate ($image, 0, 0, 255);
$red = ImageColorAllocate ($image, 255, 0, 0);
$white = ImageColorAllocate ($image, 255, 255, 255);
$black = ImageColorAllocate ($image, 0, 0, 0);
ImageString($image, 4, 20, 35, "Posts: $posts", $black);
ImageString($image, 4, 20, 51, "Karma: $karma", $black);
if ($set_gender_style == 0) {
ImageString($image, 5, 31, 4, "$membername", $black);
ImageString($image, 4, 20, 66, "Genter: $gender", $black);
} else {ImageString($image, 5, 44, 4, "$membername", $black);}
header("Content-Type: image/png");
$php = PHP_VERSION;
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($image,null,9,null);
}
else {
Imagepng($image,null,90,null);
}
ImageDestroy ($image);
ImageDestroy ($img_bgr);
}
?>
I am getting a blank page while accessing - http://www.gamerzgarage.com/sig.php?u=1
I didn't change anything out of the file. I have uploaded the images to the default/images.
brianjw
Εrror occurred. There is 7 die().
Make a file & run like sign_error.php?u=1
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else { echo 'No SSI'; die(); }
error_reporting(E_ALL ^ E_NOTICE);
getinfos();
signature();
function getinfos()
{
global $context, $db_prefix, $memberContext;
$mommy = '';
$context['error_sign'] = '';
if ($_GET['u'] >= 1)
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : $context['error_sign'] = 'No ID';
else $context['error_sign'] = 'No ID';
$result = db_query("
SELECT memberName
FROM {$db_prefix}members
WHERE ID_MEMBER = " . (int) $id_mem . "
AND is_activated = 1
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result) > 0)
{
$mprofile[] = (int) $id_mem;
loadMemberData($mprofile, false, 'profile');
foreach ($mprofile as $profile)
{
loadMemberContext($profile);
}
$context['item_comms'] = array();
$context['item_comms'][] = array(
'lbuser' => $memberContext[$id_mem]
);
foreach ($context['item_comms'] as $item_comm)
{
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
}
} else { $context['error_sign'] = 'No member ID';}
$mommy = isset($context['avatar']) ? $context['avatar'] : '';
$mommy = preg_split('/;/',$mommy, -1, PREG_SPLIT_OFFSET_CAPTURE);
$mommy = $mommy [1][0];
$mommy = trim(substr(strrchr($mommy, '='), 1));
$result2 = db_query("
SELECT filename
FROM {$db_prefix}attachments
WHERE ID_ATTACH = " . (int) $mommy . "
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result2) > 0)
{
$context['avatar_sign_id'] = array();
while ($row_items = mysql_fetch_assoc($result2))
{
$context['avatar_sign_id'][] = array(
'filename' => $row_items['filename']
);
}
foreach ($context['avatar_sign_id'] as $avatar_item)
{
$context['filename_avatar'] = $avatar_item['filename'];
}
}
unset($mommy);
mysql_free_result($result);
mysql_free_result($result2);
}
function signature()
{
global $context, $settings, $modSettings, $db_prefix;
$lemo = '';
$img_url = $settings['default_theme_url'];
$membername = $context['membername'];
$posts = $context['posts'];
if ($context['filename_avatar'] != '')
{
$lemo = $context['filename_avatar'];
}
else {
$lemo = '';
}
$avatar = $context['avatar'];
$gender = $context['gender'];
if (preg_match( '/Male/', $gender))
{
$gender = "male";
}
elseif (preg_match( '/Female/', $gender)) {
$gender = "female"; }
else {$gender = "n/a";}
$karmaBad = $context['karmaBad'];
$karmaGood = $context['karmaGood'];
if ($modSettings['karmaMode'] == '1')
{
$karma = $karmaGood - $karmaBad;
} elseif ($modSettings['karmaMode'] == '2')
{
$karma = '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif ($modSettings['karmaMode'] == '0')
{
$karma = 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++Don't SAVE your images as web & devices / images must be .png
$backimg = "$img_url/images/sign.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/sign.png
$noavatar = "$img_url/images/noavatar.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/noavatar.png
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
// Your settings +++++++++++++++++++++++++++++++++++
//$backimg = checkurl($backimg);
//$noavatar = checkurl($noavatar);
if ($avatar != '') {$avatar = $avatar;}
else {$avatar = $noavatar;}
if ($lemo != '') { $ext = substr(strrchr($lemo, '.'), 1); }
else {$ext = substr(strrchr($avatar, '.'), 1);}
unset($lemo);
if ($ext == 'png') {$img_bgr = imagecreatefrompng($avatar); }
elseif ($ext == 'jpg') {$img_bgr = imagecreatefromjpeg($avatar); }
elseif ($ext == 'gif') {$img_bgr = imagecreatefromgif($avatar); }
else { echo 'No extension'; die();}
$image_width = imagesx($img_bgr);
$image_height = imagesy($img_bgr);
//______________avatar width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
{
$set_avatar_width = $set_avatar_width + (($image_width - 101) * 0.35);
$set_avatar_height = $set_avatar_height + (($image_height - 101) * 0.35);
}
else { echo 'Wrong width/height'; die();}
$image = imagecreatetruecolor($image_width, $image_height);
$image = imagecreatefrompng($backimg);
$size = getimagesize($backimg);
$dest_x = $size[0] - $image_width + $set_avatar_width;
$dest_y = $size[1] - $image_height + $set_avatar_height;
imagecopymerge($image, $img_bgr, $dest_x, $dest_y, 0, 0, $image_width, $image_height, 100);
$green = ImageColorAllocate ($image, 23, 124, 17);
$blue = ImageColorAllocate ($image, 0, 0, 255);
$red = ImageColorAllocate ($image, 255, 0, 0);
$white = ImageColorAllocate ($image, 255, 255, 255);
$black = ImageColorAllocate ($image, 0, 0, 0);
if ($context['error_sign'] == '') { $error = 'No errors'; } else {
$error = $context['error_sign']; }
ImageString($image, 5, 33, 4, "$membername", $black);
ImageString($image, 4, 20, 35, "Posts: $posts", $black);
ImageString($image, 4, 20, 51, "Gender: $gender", $black);
ImageString($image, 4, 20, 66, "Karma: $karma", $black);
ImageString($image, 4, 20, 86, "Error: $error", $black);
header("Content-Type: image/png");
$php = PHP_VERSION;
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($image,'',9);
}
else {
Imagepng($image,'',90);
}
ImageDestroy ($image);
ImageDestroy ($img_bgr);
}
function checkurl($url)
{
$getHeaders = @get_headers($url);
if (preg_match("|200|", $getHeaders[0])) {
return $url;
unset($getHeaders);
} else { echo 'File not exist'; die();}
}
?>
I used your code, saved it as sign_error.php
then went to http://www.gamerzgarage.com/sign_error.php?u=1 and yet.. it still is blank.. :(
Any other ideas?
...well your server again...
Try my sign.png file. Re upload the updated sign_error.php <-- check
... next delete all the die(); functions. <-- check
... next delete 2 lines <-- check
$backimg = checkurl($backimg);
$noavatar = checkurl($noavatar);
... original sign.php file also updated
Ok, last problems - It is working except the errors are showing on the card like the image below:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.gamerzgarage.com%2Fsign_error.php%3Fu%3D1&hash=3e30b7a936695c5f8018a4e4f57f671743690227)
I would also like to know how to make it so it shows the ™ properly (unlike image above). Also how to make images be transparent when they are supposed to be ;) (background). How would I make it show the "image" of the male/female other than the word. And How would I add the arcade part of it like I posted/requested above.
Here is my code:
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else { echo 'No SSI'; }
error_reporting(E_ALL ^ E_NOTICE);
getinfos();
signature();
function getinfos()
{
global $context, $db_prefix, $memberContext;
$mommy = '';
$context['error_sign'] = '';
if ($_GET['u'] >= 1)
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : $context['error_sign'] = 'No ID';
else $context['error_sign'] = 'No ID';
$result = db_query("
SELECT memberName
FROM {$db_prefix}members
WHERE ID_MEMBER = " . (int) $id_mem . "
AND is_activated = 1
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result) > 0)
{
$mprofile[] = (int) $id_mem;
loadMemberData($mprofile, false, 'profile');
foreach ($mprofile as $profile)
{
loadMemberContext($profile);
}
$context['item_comms'] = array();
$context['item_comms'][] = array(
'lbuser' => $memberContext[$id_mem]
);
foreach ($context['item_comms'] as $item_comm)
{
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['good'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
}
} else { $context['error_sign'] = 'No member ID';}
$mommy = isset($context['avatar']) ? $context['avatar'] : '';
$mommy = preg_split('/;/',$mommy, -1, PREG_SPLIT_OFFSET_CAPTURE);
$mommy = $mommy [1][0];
$mommy = trim(substr(strrchr($mommy, '='), 1));
$result2 = db_query("
SELECT filename
FROM {$db_prefix}attachments
WHERE ID_ATTACH = " . (int) $mommy . "
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result2) > 0)
{
$context['avatar_sign_id'] = array();
while ($row_items = mysql_fetch_assoc($result2))
{
$context['avatar_sign_id'][] = array(
'filename' => $row_items['filename']
);
}
foreach ($context['avatar_sign_id'] as $avatar_item)
{
$context['filename_avatar'] = $avatar_item['filename'];
}
}
unset($mommy);
mysql_free_result($result);
mysql_free_result($result2);
}
function signature()
{
global $context, $settings, $modSettings, $db_prefix;
$lemo = '';
$img_url = $settings['default_theme_url'];
$membername = $context['membername'];
$posts = $context['posts'];
if ($context['filename_avatar'] != '')
{
$lemo = $context['filename_avatar'];
}
else {
$lemo = '';
}
$avatar = $context['avatar'];
$gender = $context['gender'];
if (preg_match( '/Male/', $gender))
{
$gender = "male";
}
elseif (preg_match( '/Female/', $gender)) {
$gender = "female"; }
else {$gender = "n/a";}
$karmaBad = $context['karmaBad'];
$karmaGood = $context['karmaGood'];
if ($modSettings['karmaMode'] == '1')
{
$karma = $karmaGood - $karmaBad;
} elseif ($modSettings['karmaMode'] == '2')
{
$karma = '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif ($modSettings['karmaMode'] == '0')
{
$karma = 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++Don't SAVE your images as web & devices / images must be .png
$backimg = "$img_url/images/sign.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/sign.png
$noavatar = "$img_url/images/noavatar.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/noavatar.png
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
// Your settings +++++++++++++++++++++++++++++++++++
//$backimg = checkurl($backimg);
//$noavatar = checkurl($noavatar);
if ($avatar != '') {$avatar = $avatar;}
else {$avatar = $noavatar;}
if ($lemo != '') { $ext = substr(strrchr($lemo, '.'), 1); }
else {$ext = substr(strrchr($avatar, '.'), 1);}
unset($lemo);
if ($ext == 'png') {$img_bgr = imagecreatefrompng($avatar); }
elseif ($ext == 'jpg') {$img_bgr = imagecreatefromjpeg($avatar); }
elseif ($ext == 'gif') {$img_bgr = imagecreatefromgif($avatar); }
else { echo 'No extension'; }
$image_width = imagesx($img_bgr);
$image_height = imagesy($img_bgr);
//______________avatar width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
{
$set_avatar_width = $set_avatar_width + (($image_width - 101) * 0.35);
$set_avatar_height = $set_avatar_height + (($image_height - 101) * 0.35);
}
else { echo 'Wrong width/height'; }
$image = imagecreatetruecolor($image_width, $image_height);
$image = imagecreatefrompng($backimg);
$size = getimagesize($backimg);
$dest_x = $size[0] - $image_width + $set_avatar_width;
$dest_y = $size[1] - $image_height + $set_avatar_height;
imagecopymerge($image, $img_bgr, $dest_x, $dest_y, 0, 0, $image_width, $image_height, 100);
$green = ImageColorAllocate ($image, 23, 124, 17);
$blue = ImageColorAllocate ($image, 0, 0, 255);
$red = ImageColorAllocate ($image, 255, 0, 0);
$white = ImageColorAllocate ($image, 255, 255, 255);
$black = ImageColorAllocate ($image, 0, 0, 0);
if ($context['error_sign'] == '') { $error = 'No errors'; } else {
$error = $context['error_sign']; }
ImageString($image, 5, 33, 4, "$membername", $black);
ImageString($image, 4, 20, 35, "Posts: $posts", $black);
ImageString($image, 4, 20, 51, "Genter: $gender", $black);
ImageString($image, 4, 20, 66, "Karma: $karma", $black);
ImageString($image, 4, 20, 86, "Error: $error", $black);
header("Content-Type: image/png");
$php = PHP_VERSION;
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($image,'',9);
}
else {
Imagepng($image,'',90);
}
ImageDestroy ($image);
ImageDestroy ($img_bgr);
}
function checkurl($url)
{
$getHeaders = @get_headers($url);
if (preg_match("|200|", $getHeaders[0])) {
return $url;
unset($getHeaders);
} else { echo 'File not exist'; }
}
?>
Quote from: brianjw on October 14, 2007, 12:46:19 AM
Ok, last problems - It is working except the errors are showing on the card like the image below:
What happen with updated
sign.php?
sign_error.php its only for tracing errors.
Quote from: brianjw on October 14, 2007, 12:46:19 AM
Also how to make images be transparent when they are supposed to be ;) (background)
Yes they are supposed to be transparent. Save as WEB / PNG-8 / NO-DITHER / 256 COLORS / .
Quote from: brianjw on October 14, 2007, 12:46:19 AM
How would I make it show the "image" of the male/female other than the word
sign.php updated (http://www.simplemachines.org/community/index.php?topic=46408.msg1271553#msg1271553)
$set_gender_style = 1; // 0 text , 1 image
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsign_gno.gif&hash=baf87d3e83cefc7b67ce1ba67fdbf2c25e26237b) | (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsign_gny.gif&hash=5fb0588b1785627016b9e7183aecac359a282bbd) |
Quote from: brianjw on October 14, 2007, 12:46:19 AM
I would also like to know how to make it so it shows the ™ properly (unlike image above).
Like this ?
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsign_brian.png&hash=25faa1120a586629bc00058ede4765bed59b22a7)
Quote from: brianjw on October 14, 2007, 12:46:19 AM
And How would I add the arcade part of it like I posted/requested above.
Did You mean
SMF Arcade (http://custom.simplemachines.org/mods/index.php?mod=36)?
Quote from: sebastian on October 14, 2007, 03:34:40 AM
sign.php updated (http://www.simplemachines.org/community/index.php?topic=46408.msg1271553#msg1271553)
$set_gender_style = 1; // 0 text , 1 image
I have updated sign.php with that code and it displays blank :(
Quote from: sebastian on October 14, 2007, 03:34:40 AM
Like this ?
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsign_brian.png&hash=25faa1120a586629bc00058ede4765bed59b22a7)
I ment showing the TM symbol correctly. ;)
Quote from: sebastian on October 14, 2007, 03:34:40 AM
Did You mean SMF Arcade (http://custom.simplemachines.org/mods/index.php?mod=36)?
Yes :)
Arcade last 4 games + scores + position<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else die();
getinfos();
signature();
function getinfos()
{
global $context, $db_prefix, $memberContext;
$mommy = '';
if ($_GET['u'] >= 1)
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : die();
else die();
$result = db_query("
SELECT memberName
FROM {$db_prefix}members
WHERE ID_MEMBER = " . (int) $id_mem . "
AND is_activated = 1
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result) > 0)
{
$mprofile[] = (int) $id_mem;
loadMemberData($mprofile, false, 'profile');
foreach ($mprofile as $profile)
{
loadMemberContext($profile);
}
$context['item_comms'] = array();
$context['item_comms'][] = array(
'lbuser' => $memberContext[$id_mem]
);
foreach ($context['item_comms'] as $item_comm)
{
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
}
} else die();
$mommy = isset($context['avatar']) ? $context['avatar'] : '';
$mommy = preg_split('/;/',$mommy, -1, PREG_SPLIT_OFFSET_CAPTURE);
$mommy = $mommy [1][0];
$mommy = trim(substr(strrchr($mommy, '='), 1));
$result2 = db_query("
SELECT filename
FROM {$db_prefix}attachments
WHERE ID_ATTACH = " . (int) $mommy . "
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result2) > 0)
{
$context['avatar_sign_id'] = array();
while ($row_items = mysql_fetch_assoc($result2))
{
$context['avatar_sign_id'][] = array(
'filename' => $row_items['filename']
);
}
foreach ($context['avatar_sign_id'] as $avatar_item)
{
$context['filename_avatar'] = $avatar_item['filename'];
}
}
unset($mommy);
$y = 0;
$context['arcade']['latest_games'] = ArcadeLatestGames(4, 0, $id_mem);
if (count($context['arcade']['latest_games']) > 0)
foreach ($context['arcade']['latest_games'] as $game) {
$context['arcadelast'][$y] .= $game['name'].'-'.$game['score'].'-'.$game['position'];
$y++; }
mysql_free_result($result);
mysql_free_result($result2);
}
function signature()
{
global $context, $settings, $modSettings, $db_prefix;
$lemo = '';
$img_url = $settings['default_theme_url'];
$membername = $context['membername'];
$posts = $context['posts'];
if ($context['filename_avatar'] != '')
{
$lemo = $context['filename_avatar'];
}
else {
$lemo = '';
}
$avatar = $context['avatar'];
$gender = $context['gender'];
$arcade1 = $context['arcadelast'][0];
$arcade2 = $context['arcadelast'][1];
$arcade3 = $context['arcadelast'][2];
$arcade4 = $context['arcadelast'][3];
if (preg_match( '/Male/', $gender))
{
$gender = "male";
$img_gender = "$img_url/images/Male.gif";
}
elseif (preg_match( '/Female/', $gender)) {
$gender = "female";
$img_gender = "$img_url/images/Female.gif"; }
else {$gender = "n/a"; $img_gender = "$img_url/images/star.gif";}
$karmaBad = $context['karmaBad'];
$karmaGood = $context['karmaGood'];
if ($modSettings['karmaMode'] == '1')
{
$karma = $karmaGood - $karmaBad;
} elseif ($modSettings['karmaMode'] == '2')
{
$karma = '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif ($modSettings['karmaMode'] == '0')
{
$karma = 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++
$backimg = "$img_url/images/sign.png"; // or where you want
$noavatar = "$img_url/images/noavatar.png"; // or where you want
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
$set_gender_style = 1; // 0 text , 1 image
$set_gender_height = -92; //move gender up/down
$set_gender_width = -230; //move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++
if ($avatar != '') {$avatar = $avatar;}
else {$avatar = $noavatar;}
if ($lemo != '') { $ext = substr(strrchr($lemo, '.'), 1); }
else {$ext = substr(strrchr($avatar, '.'), 1);}
unset($lemo);
if ($ext == 'png') {$img_bgr = imagecreatefrompng($avatar); }
elseif ($ext == 'jpg') {$img_bgr = imagecreatefromjpeg($avatar); }
elseif ($ext == 'gif') {$img_bgr = imagecreatefromgif($avatar); }
else die();
$size = getimagesize($backimg);
if ($set_gender_style == 1) {
$img_bgr_gender = imagecreatefromgif($img_gender);
$image_width_gender = imagesx($img_bgr_gender);
$image_height_gender = imagesy($img_bgr_gender);
$dest_x_gender = $size[0] - $image_width_gender + $set_gender_width;
$dest_y_gender = $size[1] - $image_height_gender + $set_gender_height;
}
$image_width = imagesx($img_bgr);
$image_height = imagesy($img_bgr);
//______________avatar width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
{
$set_avatar_width = $set_avatar_width + (($image_width - 101) * 0.35);
$set_avatar_height = $set_avatar_height + (($image_height - 101) * 0.35);
}
else { die();}
$image = imagecreatetruecolor($image_width, $image_height);
$image = imagecreatefrompng($backimg);
$dest_x = $size[0] - $image_width + $set_avatar_width;
$dest_y = $size[1] - $image_height + $set_avatar_height;
imagecopymerge($image, $img_bgr, $dest_x, $dest_y, 0, 0, $image_width, $image_height, 100);
if ($set_gender_style == 1) {
imagecopymerge($image, $img_bgr_gender, $dest_x_gender, $dest_y_gender, 0, 0, $image_width_gender, $image_height_gender, 100);
}
$green = ImageColorAllocate ($image, 23, 124, 17);
$blue = ImageColorAllocate ($image, 0, 0, 255);
$red = ImageColorAllocate ($image, 255, 0, 0);
$white = ImageColorAllocate ($image, 255, 255, 255);
$black = ImageColorAllocate ($image, 0, 0, 0);
ImageString($image, 4, 20, 35, "Posts: $posts", $black);
ImageString($image, 4, 20, 51, "Karma: $karma", $black);
ImageString($image, 2, 1, 67, "Arcade: $arcade1", $black);
ImageString($image, 2, 1, 77, "Last 4: $arcade2", $black);
ImageString($image, 2, 1, 87, "Played: $arcade3", $black);
ImageString($image, 2, 1, 97, "Games : $arcade4", $black);
if ($set_gender_style == 0) {
ImageString($image, 5, 31, 4, "$membername", $black);
ImageString($image, 4, 20, 66, "Gender: $gender", $black);
} else {ImageString($image, 5, 44, 4, "$membername", $black);}
header("Content-Type: image/png");
$php = PHP_VERSION;
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($image,null,9,null);
}
else {
Imagepng($image,null,90,null);
}
ImageDestroy ($image);
ImageDestroy ($img_bgr);
}
function ArcadeLatestGames($count = 4, $start = 0, $mem_id = null)
{
global $db_prefix;
$games = db_query("
SELECT game.gameName, score.score, score.position, score.endTime
FROM ({$db_prefix}arcade_scores AS score, {$db_prefix}arcade_games AS game)
WHERE score.ID_MEMBER = ". $mem_id ." AND score.ID_GAME = game.ID_GAME
ORDER BY endTime DESC
LIMIT $start,$count",__FILE__,__LINE__);
$data = array();
while ($game = mysql_fetch_assoc($games))
$data[] = array(
'name' => $game['gameName'],
'score' => comma_format($game['score']),
'position' => ($game['position'])
);
return $data;
mysql_free_result($games);
}
?>
--------------------------------------------
Quote from: brianjw on October 14, 2007, 10:24:13 AM
I have updated sign.php with that code and it displays blank
Sign.php or Sign_arcade.php1. Well ... // again or delete 2 lines.
//$backimg = checkurl($backimg);
//$noavatar = checkurl($noavatar);
2.
Add error_reporting(E_ALL ^ E_NOTICE);
before getinfos();
3. delete all die();
For the arcade, can you make it display the latest 4 games played ONLY and show them in images (no text for the arcade).
-----------------------------------------------------------------------------------------------------------------
sign.php
I did everything you said and it shows up a broken image or when you refresh it shows up in the following like characters. Make them show in images like: (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.gamerzgarage.com%2FGames%2FactiondrivinggameXec.gif&hash=7667abb03b77651745b89993efbbc34eafda5aef) EXCEPT resize them to be more like: (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.gamerzgarage.com%2FGames%2FactiondrivinggameXec.gif&hash=7667abb03b77651745b89993efbbc34eafda5aef)
Quote
<br />
<b>Warning</b>: mysql_free_result(): supplied argument is not a valid MySQL result resource in <b>/home/content/b/j/w/bjwilson/html/sign.php</b> on line <b>90</b><br />
‰PNG
IHDRnYPj IDAT8í½y˜%Gu/xNDär—Ú÷­—êîjµZ­V·ö]` ²Ø1‹mìáÁÆð<c|cüÀï
ãñàÇ{àcì÷0›Ý ´´ºµµ¤îVï]û^uë.™qæÈ›7oÞ{«oõ&©«~ßýª2##O,'¶³zžkXÃNžçDÿ®a
«ˆýkÛ¶*Gô™™Ï¼¸—wöý÷¿HÝööéo|¾ù}°tÿ÷Zßûû03–Þ¶ÛnlᜊkXÃÅ,"¸-
ù|>Æ*ä{þÂì'Ï~X'œùéùû6¼ë#3Ï<ÚýºwŒÝÿÝÖ7ýöWš·îš QÈ´ÿ¯Ÿoé_Ÿlh\c˜5\LÀ\×Å|>ŸËå´Ö†O¼ÙÉüè‰'/ºpì¥;~#ÑÕß¶ûVò=äÂ'"BËžÞû`nüÔÑû&ôllúÀ'Z7]ÒÐÝ¿6Ȭáâ@È'Œ±D"ù|>›ÍVQÒŸßûð©Ï}tÓ;>Ô¶ãzî¸ iZ cÈ8p®
ùéç~õÂ?ýUáÝßxû[Û::,Ëz¥‹¹†5œLwÏ3¬'L&é"¼¹é'/~rëûÿCÛŽëÁ+Pn ¤­4^AD@ŒBX]W¿^¸‰'ÿá/¶t_~Ã-ÍÍͯΥ··FFFÎ,òŠ^_ÃkˆHDŒ1 ¢È²^ú"ßÿ;9v¼íÒk Ÿ#¯¾GÒ¥€(à0¼,ˆÄ9
‹,µn»ôšTvnüÞoïîKl¿Ìqèë뫚‰ááá³,†¡¼":afz{{ëyqxx¸¯¯Ï°G4pm‡põÀp‹ùâ"\Íû™...ìè Í-Í0"(äÉ/€ïƒV¤ H"2dŒ"%Qkоç#ó§FO¾| § ­­
Ož<i'€ðVk}NJR?húúúÂÌ,ƒ0~x}®r¾†W?Â9˜aÒ'
ÚIIIDäûTðÀ÷H©`« #ÆsÐÀ€B€%àK•Ëå"RfäŠâ¶³ãǯˆ`4þÙ¼»†Õƒè"¢43ËúÔß?ûü#þ¨ãÒ«-Ë!é"ô@ÊâÊJkÆq"ˆ ¸7›™|ñÉS¼á`祻ÓiÛ¶
ÍXÚÑ7ÀÑ£G+C–y½Å‰=ª|}TõÝ5¬!,,áÓb͵ù,,ˆR½ë­ßüÄÓ_ûŒõ"oï¾û·[Ö]B¾$ß-Aë`µ,€ˆÀ1ÀÄÌ‹OíùÁ?LñÔƒÝWmغ}ýúõ‰D¢Rš Õ:æª!‡Þ´iÓÆ>›6m€Ã‡‡'M,,Êרæ:¤{Tùt
kˆ!*T1¬UÌeY}—í:ü±Ï/|ý?ýä?¾qèHïÎ[Hz$e°¸/'Î'kDyêG?{úÏíØ³ñ¦-[¶ìÚµ«¿¿ß²¬ªÓ•:Y:´eËÓ¾Ííi nÙ²%3¤pèÐ!s[™ÜÚœj
µJT´Öfq/ Ü,&¢D"1888ü'?;üÜÓûø¥Æî
Ɇ6ò=Ò
--there is more on the link below--
http://www.gamerzgarage.com/sign.php?u=1
Here is my code:
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else
error_reporting(E_ALL ^ E_NOTICE);
getinfos();
signature();
function getinfos()
{
global $context, $db_prefix, $memberContext;
$mommy = '';
if ($_GET['u'] >= 1)
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] :
$result = db_query("
SELECT memberName
FROM {$db_prefix}members
WHERE ID_MEMBER = " . (int) $id_mem . "
AND is_activated = 1
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result) > 0)
{
$mprofile[] = (int) $id_mem;
loadMemberData($mprofile, false, 'profile');
foreach ($mprofile as $profile)
{
loadMemberContext($profile);
}
$context['item_comms'] = array();
$context['item_comms'][] = array(
'lbuser' => $memberContext[$id_mem]
);
foreach ($context['item_comms'] as $item_comm)
{
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['good'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
}
} else
$mommy = isset($context['avatar']) ? $context['avatar'] : '';
$mommy = preg_split('/;/',$mommy, -1, PREG_SPLIT_OFFSET_CAPTURE);
$mommy = $mommy [1][0];
$mommy = trim(substr(strrchr($mommy, '='), 1));
$result2 = db_query("
SELECT filename
FROM {$db_prefix}attachments
WHERE ID_ATTACH = " . (int) $mommy . "
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result2) > 0)
{
$context['avatar_sign_id'] = array();
while ($row_items = mysql_fetch_assoc($result2))
{
$context['avatar_sign_id'][] = array(
'filename' => $row_items['filename']
);
}
foreach ($context['avatar_sign_id'] as $avatar_item)
{
$context['filename_avatar'] = $avatar_item['filename'];
}
}
unset($mommy);
mysql_free_result($result);
mysql_free_result($result2);
}
function signature()
{
global $context, $settings, $modSettings, $db_prefix;
$lemo = '';
$img_url = $settings['default_theme_url'];
$membername = $context['membername'];
$posts = $context['posts'];
if ($context['filename_avatar'] != '')
{
$lemo = $context['filename_avatar'];
}
else {
$lemo = '';
}
$avatar = $context['avatar'];
$gender = $context['gender'];
if (preg_match( '/Male/', $gender))
{
$gender = "male";
$img_gender = "$img_url/images/Male.gif";
}
elseif (preg_match( '/Female/', $gender)) {
$gender = "female";
$img_gender = "$img_url/images/Female.gif"; }
else {$gender = "n/a"; $img_gender = "$img_url/images/star.gif";}
$karmaBad = $context['karmaBad'];
$karmaGood = $context['karmaGood'];
if ($modSettings['karmaMode'] == '1')
{
$karma = $karmaGood - $karmaBad;
} elseif ($modSettings['karmaMode'] == '2')
{
$karma = '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif ($modSettings['karmaMode'] == '0')
{
$karma = 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++
$backimg = "$img_url/images/sign.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/sign.png
$noavatar = "$img_url/images/noavatar.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/noavatar.png
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
$set_gender_style = 0; // 0 text , 1 image
$set_gender_height = -92; //move gender up/down
$set_gender_width = -230; //move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++
// $backimg = checkurl($backimg);
// $noavatar = checkurl($noavatar);
if ($avatar != '') {$avatar = $avatar;}
else {$avatar = $noavatar;}
if ($lemo != '') { $ext = substr(strrchr($lemo, '.'), 1); }
else {$ext = substr(strrchr($avatar, '.'), 1);}
unset($lemo);
if ($ext == 'png') {$img_bgr = imagecreatefrompng($avatar); }
elseif ($ext == 'jpg') {$img_bgr = imagecreatefromjpeg($avatar); }
elseif ($ext == 'gif') {$img_bgr = imagecreatefromgif($avatar); }
else
$size = getimagesize($backimg);
if ($set_gender_style == 1) {
$img_bgr_gender = imagecreatefromgif($img_gender);
$image_width_gender = imagesx($img_bgr_gender);
$image_height_gender = imagesy($img_bgr_gender);
$dest_x_gender = $size[0] - $image_width_gender + $set_gender_width;
$dest_y_gender = $size[1] - $image_height_gender + $set_gender_height;
}
$image_width = imagesx($img_bgr);
$image_height = imagesy($img_bgr);
//______________avatar width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
{
$set_avatar_width = $set_avatar_width + (($image_width - 101) * 0.35);
$set_avatar_height = $set_avatar_height + (($image_height - 101) * 0.35);
}
else { }
$image = imagecreatetruecolor($image_width, $image_height);
$image = imagecreatefrompng($backimg);
$dest_x = $size[0] - $image_width + $set_avatar_width;
$dest_y = $size[1] - $image_height + $set_avatar_height;
imagecopymerge($image, $img_bgr, $dest_x, $dest_y, 0, 0, $image_width, $image_height, 100);
if ($set_gender_style == 1) {
imagecopymerge($image, $img_bgr_gender, $dest_x_gender, $dest_y_gender, 0, 0, $image_width_gender, $image_height_gender, 100);
}
$green = ImageColorAllocate ($image, 23, 124, 17);
$blue = ImageColorAllocate ($image, 0, 0, 255);
$red = ImageColorAllocate ($image, 255, 0, 0);
$white = ImageColorAllocate ($image, 255, 255, 255);
$black = ImageColorAllocate ($image, 0, 0, 0);
ImageString($image, 4, 20, 35, "Posts: $posts", $black);
ImageString($image, 4, 20, 51, "Karma: $karma", $black);
if ($set_gender_style == 0) {
ImageString($image, 5, 31, 4, "$membername", $black);
ImageString($image, 4, 20, 66, "Genter: $gender", $black);
} else {ImageString($image, 5, 44, 4, "$membername", $black);}
header("Content-Type: image/png");
$php = PHP_VERSION;
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($image,'',9);
}
else {
Imagepng($image,'',90);
}
ImageDestroy ($image);
ImageDestroy ($img_bgr);
}
function checkurl($url)
{
$getHeaders = @get_headers($url);
if (preg_match("|200|", $getHeaders[0])) {
return $url;
unset($getHeaders);
} else { }
}
?>
I get nothing, when I run the error file I get Wrong width/height
I assume this is due to the fact that my avatars are 125/100
Please advice :)
Thanks,
Embrace
Quote from: Embrace on October 15, 2007, 07:43:13 PM
I get nothing, when I run the error file I get Wrong width/height
I assume this is due to the fact that my avatars are 125/100
Please advice :)
Thanks,
Embrace
Well take some decisions:
1. Reduce your avatar height to <106px or
2. Make your sign.png file biggest >135px also set new height restrictions
//______________avatar width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=126 && $image_height >=10)
{
$set_avatar_width = $set_avatar_width + (($image_width - 101) * 0.35);
$set_avatar_height = $set_avatar_height + (($image_height - 121) * 0.35);
}
else { die();}
Bellow an image for example: height 135px / width 300px;
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsign135.png&hash=ffc5822c9f87bbb4dd577c2d9b5cb5cf40ad4f2a)
@
brianjwYour script without die(); has some errors. You must remove
else also
[ else { die(); } ]. Anyway.
try a new
brian_error.php
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else { echo 'No SSI'; die(); }
error_reporting(E_ALL ^ E_NOTICE);
getinfos();
signature();
function getinfos()
{
global $context, $db_prefix, $memberContext;
$mommy = '';
if ($_GET['u'] >= 1)
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : die();
else { echo 'No id'; die();}
$result = db_query("
SELECT memberName
FROM {$db_prefix}members
WHERE ID_MEMBER = " . (int) $id_mem . "
AND is_activated = 1
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result) > 0)
{
$mprofile[] = (int) $id_mem;
loadMemberData($mprofile, false, 'profile');
foreach ($mprofile as $profile)
{
loadMemberContext($profile);
}
$context['item_comms'] = array();
$context['item_comms'][] = array(
'lbuser' => $memberContext[$id_mem]
);
foreach ($context['item_comms'] as $item_comm)
{
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
}
} else { $context['error_sign'] = 'No member ID';}
$mommy = isset($context['avatar']) ? $context['avatar'] : '';
$mommy = preg_split('/;/',$mommy, -1, PREG_SPLIT_OFFSET_CAPTURE);
$mommy = $mommy [1][0];
$mommy = trim(substr(strrchr($mommy, '='), 1));
$result2 = db_query("
SELECT filename
FROM {$db_prefix}attachments
WHERE ID_ATTACH = " . (int) $mommy . "
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result2) > 0)
{
$context['avatar_sign_id'] = array();
while ($row_items = mysql_fetch_assoc($result2))
{
$context['avatar_sign_id'][] = array(
'filename' => $row_items['filename']
);
}
foreach ($context['avatar_sign_id'] as $avatar_item)
{
$context['filename_avatar'] = $avatar_item['filename'];
}
}
unset($mommy);
mysql_free_result($result);
mysql_free_result($result2);
}
function signature()
{
global $context, $settings, $modSettings, $db_prefix;
$lemo = '';
$img_url = $settings['default_theme_url'];
$membername = $context['membername'];
$posts = $context['posts'];
if ($context['filename_avatar'] != '')
{
$lemo = $context['filename_avatar'];
}
else {
$lemo = '';
}
$avatar = $context['avatar'];
$gender = $context['gender'];
if (preg_match( '/Male/', $gender))
{
$gender = "male";
$img_gender = "$img_url/images/Male.gif";
}
elseif (preg_match( '/Female/', $gender)) {
$gender = "female";
$img_gender = "$img_url/images/Female.gif"; }
else {$gender = "n/a"; $img_gender = "$img_url/images/star.gif";}
$karmaBad = $context['karmaBad'];
$karmaGood = $context['karmaGood'];
if ($modSettings['karmaMode'] == '1')
{
$karma = $karmaGood - $karmaBad;
} elseif ($modSettings['karmaMode'] == '2')
{
$karma = '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif ($modSettings['karmaMode'] == '0')
{
$karma = 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++
$backimg = "$img_url/images/sign.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/sign.png
$noavatar = "$img_url/images/noavatar.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/noavatar.png
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
$set_gender_style = 0; // 0 text , 1 image
$set_gender_height = -92; //move gender up/down
$set_gender_width = -230; //move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++
//$backimg = checkurl($backimg);
//$noavatar = checkurl($noavatar);
if ($avatar != '') {$avatar = $avatar;}
else {$avatar = $noavatar;}
if ($lemo != '') { $ext = substr(strrchr($lemo, '.'), 1); }
else {$ext = substr(strrchr($avatar, '.'), 1);}
unset($lemo);
if ($ext == 'png') {$img_bgr = imagecreatefrompng($avatar); }
elseif ($ext == 'jpg') {$img_bgr = imagecreatefromjpeg($avatar); }
elseif ($ext == 'gif') {$img_bgr = imagecreatefromgif($avatar); }
else { echo 'No extension'; die();}
$size = getimagesize($backimg);
if ($set_gender_style == 1) {
$img_bgr_gender = imagecreatefromgif($img_gender);
$image_width_gender = imagesx($img_bgr_gender);
$image_height_gender = imagesy($img_bgr_gender);
$dest_x_gender = $size[0] - $image_width_gender + $set_gender_width;
$dest_y_gender = $size[1] - $image_height_gender + $set_gender_height;
}
$image_width = imagesx($img_bgr);
$image_height = imagesy($img_bgr);
//______________avatar width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
{
$set_avatar_width = $set_avatar_width + (($image_width - 101) * 0.35);
$set_avatar_height = $set_avatar_height + (($image_height - 101) * 0.35);
}
else { echo 'Wrong width/height'; die();}
$image = imagecreatetruecolor($image_width, $image_height);
$image = imagecreatefrompng($backimg);
$dest_x = $size[0] - $image_width + $set_avatar_width;
$dest_y = $size[1] - $image_height + $set_avatar_height;
imagecopymerge($image, $img_bgr, $dest_x, $dest_y, 0, 0, $image_width, $image_height, 100);
if ($set_gender_style == 1) {
imagecopymerge($image, $img_bgr_gender, $dest_x_gender, $dest_y_gender, 0, 0, $image_width_gender, $image_height_gender, 100);
}
$green = ImageColorAllocate ($image, 23, 124, 17);
$blue = ImageColorAllocate ($image, 0, 0, 255);
$red = ImageColorAllocate ($image, 255, 0, 0);
$white = ImageColorAllocate ($image, 255, 255, 255);
$black = ImageColorAllocate ($image, 0, 0, 0);
ImageString($image, 4, 20, 35, "Posts: $posts", $black);
ImageString($image, 4, 20, 51, "Karma: $karma", $black);
if ($set_gender_style == 0) {
ImageString($image, 5, 31, 4, "$membername", $black);
ImageString($image, 4, 20, 66, "Genter: $gender", $black);
} else {ImageString($image, 5, 44, 4, "$membername", $black);}
header("Content-Type: image/png");
$php = PHP_VERSION;
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($image,'',9);
}
else {
Imagepng($image,'',90);
}
ImageDestroy ($image);
ImageDestroy ($img_bgr);
}
function checkurl($url)
{
$getHeaders = @get_headers($url);
if (preg_match("|200|", $getHeaders[0])) {
return $url;
unset($getHeaders);
} else { echo 'File not exist'; die();}
}
?>
Well the error when I run http://www.gamerzgarage.com/sign.php?u=1 was
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/content/b/j/w/bjwilson/html/sign.php on line 88
and the code being used is
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
getinfos();
signature();
function getinfos()
{
global $context, $db_prefix, $memberContext;
$mommy = '';
if ($_GET['u'] >= 1)
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] :
$result = db_query("
SELECT memberName
FROM {$db_prefix}members
WHERE ID_MEMBER = " . (int) $id_mem . "
AND is_activated = 1
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result) > 0)
{
$mprofile[] = (int) $id_mem;
loadMemberData($mprofile, false, 'profile');
foreach ($mprofile as $profile)
{
loadMemberContext($profile);
}
$context['item_comms'] = array();
$context['item_comms'][] = array(
'lbuser' => $memberContext[$id_mem]
);
foreach ($context['item_comms'] as $item_comm)
{
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['good'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
}
}
$mommy = isset($context['avatar']) ? $context['avatar'] : '';
$mommy = preg_split('/;/',$mommy, -1, PREG_SPLIT_OFFSET_CAPTURE);
$mommy = $mommy [1][0];
$mommy = trim(substr(strrchr($mommy, '='), 1));
$result2 = db_query("
SELECT filename
FROM {$db_prefix}attachments
WHERE ID_ATTACH = " . (int) $mommy . "
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result2) > 0)
{
$context['avatar_sign_id'] = array();
while ($row_items = mysql_fetch_assoc($result2))
{
$context['avatar_sign_id'][] = array(
'filename' => $row_items['filename']
);
}
foreach ($context['avatar_sign_id'] as $avatar_item)
{
$context['filename_avatar'] = $avatar_item['filename'];
}
}
unset($mommy);
mysql_free_result($result);
mysql_free_result($result2);
}
function signature()
{
global $context, $settings, $modSettings, $db_prefix;
$lemo = '';
$img_url = $settings['default_theme_url'];
$membername = $context['membername'];
$posts = $context['posts'];
if ($context['filename_avatar'] != '')
{
$lemo = $context['filename_avatar'];
}
else {
$lemo = '';
}
$avatar = $context['avatar'];
$gender = $context['gender'];
if (preg_match( '/Male/', $gender))
{
$gender = "male";
$img_gender = "$img_url/images/Male.gif";
}
elseif (preg_match( '/Female/', $gender)) {
$gender = "female";
$img_gender = "$img_url/images/Female.gif"; }
else {$gender = "n/a"; $img_gender = "$img_url/images/star.gif";}
$karmaBad = $context['karmaBad'];
$karmaGood = $context['karmaGood'];
if ($modSettings['karmaMode'] == '1')
{
$karma = $karmaGood - $karmaBad;
} elseif ($modSettings['karmaMode'] == '2')
{
$karma = '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif ($modSettings['karmaMode'] == '0')
{
$karma = 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++
$backimg = "$img_url/images/sign.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/sign.png
$noavatar = "$img_url/images/noavatar.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/noavatar.png
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
$set_gender_style = 0; // 0 text , 1 image
$set_gender_height = -92; //move gender up/down
$set_gender_width = -230; //move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++
$backimg = checkurl($backimg);
$noavatar = checkurl($noavatar);
if ($avatar != '') {$avatar = $avatar;}
else {$avatar = $noavatar;}
if ($lemo != '') { $ext = substr(strrchr($lemo, '.'), 1); }
else {$ext = substr(strrchr($avatar, '.'), 1);}
unset($lemo);
if ($ext == 'png') {$img_bgr = imagecreatefrompng($avatar); }
elseif ($ext == 'jpg') {$img_bgr = imagecreatefromjpeg($avatar); }
elseif ($ext == 'gif') {$img_bgr = imagecreatefromgif($avatar); }
$size = getimagesize($backimg);
if ($set_gender_style == 1) {
$img_bgr_gender = imagecreatefromgif($img_gender);
$image_width_gender = imagesx($img_bgr_gender);
$image_height_gender = imagesy($img_bgr_gender);
$dest_x_gender = $size[0] - $image_width_gender + $set_gender_width;
$dest_y_gender = $size[1] - $image_height_gender + $set_gender_height;
}
$image_width = imagesx($img_bgr);
$image_height = imagesy($img_bgr);
//______________avatar width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
{
$set_avatar_width = $set_avatar_width + (($image_width - 101) * 0.35);
$set_avatar_height = $set_avatar_height + (($image_height - 101) * 0.35);
}
$image = imagecreatetruecolor($image_width, $image_height);
$image = imagecreatefrompng($backimg);
$dest_x = $size[0] - $image_width + $set_avatar_width;
$dest_y = $size[1] - $image_height + $set_avatar_height;
imagecopymerge($image, $img_bgr, $dest_x, $dest_y, 0, 0, $image_width, $image_height, 100);
if ($set_gender_style == 1) {
imagecopymerge($image, $img_bgr_gender, $dest_x_gender, $dest_y_gender, 0, 0, $image_width_gender, $image_height_gender, 100);
}
$green = ImageColorAllocate ($image, 23, 124, 17);
$blue = ImageColorAllocate ($image, 0, 0, 255);
$red = ImageColorAllocate ($image, 255, 0, 0);
$white = ImageColorAllocate ($image, 255, 255, 255);
$black = ImageColorAllocate ($image, 0, 0, 0);
ImageString($image, 4, 20, 35, "Posts: $posts", $black);
ImageString($image, 4, 20, 51, "Karma: $karma", $black);
if ($set_gender_style == 0) {
ImageString($image, 5, 31, 4, "$membername", $black);
ImageString($image, 4, 20, 66, "Gender: $gender", $black);
} else {ImageString($image, 5, 44, 4, "$membername", $black);}
header("Content-Type: image/png");
$php = PHP_VERSION;
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($image,'',9);
}
else {
Imagepng($image,'',90);
}
ImageDestroy ($image);
ImageDestroy ($img_bgr);
}
function checkurl($url)
{
$getHeaders = @get_headers($url);
if (preg_match("|200|", $getHeaders[0])) {
return $url;
unset($getHeaders);
}
}
?>
------------------------------------------------------
brian_error.php is working well :)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.gamerzgarage.com%2Fbrian_error.php%3Fu%3D1&hash=e078d506b522bc38c49eb11cb0553fce479d2440)
Brianjw
the sign_error.php was the only one that worked for me also
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.knightsofnight.com%2Fsign_error.php%3Fu%3D3&hash=0308258b239fb5f6e34e85ccfd2adf258c3e9aaf)
Gonna modify alot, add the money and such there also :)
WOOOT! got everything working
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.knightsofnight.com%2Fsign_error.php%3Fu%3D3&hash=0308258b239fb5f6e34e85ccfd2adf258c3e9aaf)(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fxfiresigs.com%2FEmbrace.png&hash=2a9675d726b08d4579e864635f617204c1fe2e00)
EDIT: is there anyway for me to make the image a png extension, some of the forums I use do not allow php files and I would like to post it on them.
Thanks :)
@brianjw & @Embrace i thing the problem is 2 lines. (sign.php)
$backimg = checkurl($backimg); delete or //
$noavatar = checkurl($noavatar); delete or //
Please take a time to confirm it or not.
If not also try to add this error_reporting(E_ALL ^ E_NOTICE); at the top of the script.
...or copy paste & make sig.php
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else die();
error_reporting(E_ALL ^ E_NOTICE);
getinfos();
signature();
function getinfos()
{
global $context, $db_prefix, $memberContext;
$mommy = '';
if ($_GET['u'] >= 1)
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : die();
else die();
$result = db_query("
SELECT memberName
FROM {$db_prefix}members
WHERE ID_MEMBER = " . (int) $id_mem . "
AND is_activated = 1
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result) > 0)
{
$mprofile[] = (int) $id_mem;
loadMemberData($mprofile, false, 'profile');
foreach ($mprofile as $profile)
{
loadMemberContext($profile);
}
$context['item_comms'] = array();
$context['item_comms'][] = array(
'lbuser' => $memberContext[$id_mem]
);
foreach ($context['item_comms'] as $item_comm)
{
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
}
} else die();
$mommy = isset($context['avatar']) ? $context['avatar'] : '';
$mommy = preg_split('/;/',$mommy, -1, PREG_SPLIT_OFFSET_CAPTURE);
$mommy = $mommy [1][0];
$mommy = trim(substr(strrchr($mommy, '='), 1));
$result2 = db_query("
SELECT filename
FROM {$db_prefix}attachments
WHERE ID_ATTACH = " . (int) $mommy . "
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result2) > 0)
{
$context['avatar_sign_id'] = array();
while ($row_items = mysql_fetch_assoc($result2))
{
$context['avatar_sign_id'][] = array(
'filename' => $row_items['filename']
);
}
foreach ($context['avatar_sign_id'] as $avatar_item)
{
$context['filename_avatar'] = $avatar_item['filename'];
}
}
unset($mommy);
mysql_free_result($result);
mysql_free_result($result2);
}
function signature()
{
global $context, $settings, $modSettings, $db_prefix;
$lemo = '';
$img_url = $settings['default_theme_url'];
$membername = $context['membername'];
$posts = $context['posts'];
if ($context['filename_avatar'] != '')
{
$lemo = $context['filename_avatar'];
}
else {
$lemo = '';
}
$avatar = $context['avatar'];
$gender = $context['gender'];
if (preg_match( '/Male/', $gender))
{
$gender = "male";
$img_gender = "$img_url/images/Male.gif";
}
elseif (preg_match( '/Female/', $gender)) {
$gender = "female";
$img_gender = "$img_url/images/Female.gif"; }
else {$gender = "n/a"; $img_gender = "$img_url/images/star.gif";}
$karmaBad = $context['karmaBad'];
$karmaGood = $context['karmaGood'];
if ($modSettings['karmaMode'] == '1')
{
$karma = $karmaGood - $karmaBad;
} elseif ($modSettings['karmaMode'] == '2')
{
$karma = '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif ($modSettings['karmaMode'] == '0')
{
$karma = 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++
$backimg = "$img_url/images/sign.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/sign.png
$noavatar = "$img_url/images/noavatar.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/noavatar.png
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
$set_gender_style = 0; // 0 text , 1 image
$set_gender_height = -92; //move gender up/down
$set_gender_width = -230; //move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++
if ($avatar != '') {$avatar = $avatar;}
else {$avatar = $noavatar;}
if ($lemo != '') { $ext = substr(strrchr($lemo, '.'), 1); }
else {$ext = substr(strrchr($avatar, '.'), 1);}
unset($lemo);
if ($ext == 'png') {$img_bgr = imagecreatefrompng($avatar); }
elseif ($ext == 'jpg') {$img_bgr = imagecreatefromjpeg($avatar); }
elseif ($ext == 'gif') {$img_bgr = imagecreatefromgif($avatar); }
else die();
$size = getimagesize($backimg);
if ($set_gender_style == 1) {
$img_bgr_gender = imagecreatefromgif($img_gender);
$image_width_gender = imagesx($img_bgr_gender);
$image_height_gender = imagesy($img_bgr_gender);
$dest_x_gender = $size[0] - $image_width_gender + $set_gender_width;
$dest_y_gender = $size[1] - $image_height_gender + $set_gender_height;
}
$image_width = imagesx($img_bgr);
$image_height = imagesy($img_bgr);
//______________avatar width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
{
$set_avatar_width = $set_avatar_width + (($image_width - 101) * 0.35);
$set_avatar_height = $set_avatar_height + (($image_height - 101) * 0.35);
}
else { die();}
$image = imagecreatetruecolor($image_width, $image_height);
$image = imagecreatefrompng($backimg);
$dest_x = $size[0] - $image_width + $set_avatar_width;
$dest_y = $size[1] - $image_height + $set_avatar_height;
imagecopymerge($image, $img_bgr, $dest_x, $dest_y, 0, 0, $image_width, $image_height, 100);
if ($set_gender_style == 1) {
imagecopymerge($image, $img_bgr_gender, $dest_x_gender, $dest_y_gender, 0, 0, $image_width_gender, $image_height_gender, 100);
}
$green = ImageColorAllocate ($image, 23, 124, 17);
$blue = ImageColorAllocate ($image, 0, 0, 255);
$red = ImageColorAllocate ($image, 255, 0, 0);
$white = ImageColorAllocate ($image, 255, 255, 255);
$black = ImageColorAllocate ($image, 0, 0, 0);
ImageString($image, 4, 20, 35, "Posts: $posts", $black);
ImageString($image, 4, 20, 51, "Karma: $karma", $black);
if ($set_gender_style == 0) {
ImageString($image, 5, 31, 4, "$membername", $black);
ImageString($image, 4, 20, 66, "Genter: $gender", $black);
} else {ImageString($image, 5, 44, 4, "$membername", $black);}
header("Content-Type: image/png");
$php = PHP_VERSION;
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($image,'',9);
}
else {
Imagepng($image,'',90);
}
ImageDestroy ($image);
ImageDestroy ($img_bgr);
}
?>
Ok awesome, I got it working... the only thing I need now is, somtimes the font shows up red, sometimes black?
How can I add the money from the smfshop mod, I want to replace the gender with that...
Thanks!
Quote from: Embrace on October 15, 2007, 11:39:29 PM
... is there anyway for me to make the image a png extension, some of the forums I use do not allow php files and I would like to post it on them.
open your .htaccess ADD this line AddType application/x-httpd-php .png
then rename your .php file to .png file... sign.php -> sign.png
access as
[img]http://mydomain/sign.png[/img]
Quote from: Embrace on October 16, 2007, 12:36:04 AM
... the only thing I need now is, somtimes the font shows up red, sometimes black?
You mean Posts: 532 or Posts: 532 alternately?
smf shop money
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fsign_mn.gif&hash=f5d5446e950ef096730993c7c0616e2e774273d5)
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else die();
getinfos();
signature();
function getinfos()
{
global $context, $db_prefix, $memberContext;
$mommy = '';
if ($_GET['u'] >= 1)
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : die();
else die();
$result = db_query("
SELECT memberName, money
FROM {$db_prefix}members
WHERE ID_MEMBER = " . (int) $id_mem . "
AND is_activated = 1
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result) > 0)
{
$mprofile[] = (int) $id_mem;
loadMemberData($mprofile, false, 'profile');
foreach ($mprofile as $profile)
{
loadMemberContext($profile);
}
$context['item_comms'] = array();
$context['item_comms'][] = array(
'lbuser' => $memberContext[$id_mem]
);
foreach ($context['item_comms'] as $item_comm)
{
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
}
$context['members_money'] = array();
while ($money_items = mysql_fetch_assoc($result))
{
$context['members_money'][] = array(
'get_money' => $money_items['money']
);
}
foreach ($context['members_money'] as $member_money)
{
$context['money'] = $member_money['get_money'];
}
} else die();
$mommy = isset($context['avatar']) ? $context['avatar'] : '';
$mommy = preg_split('/;/',$mommy, -1, PREG_SPLIT_OFFSET_CAPTURE);
$mommy = $mommy [1][0];
$mommy = trim(substr(strrchr($mommy, '='), 1));
$result2 = db_query("
SELECT filename
FROM {$db_prefix}attachments
WHERE ID_ATTACH = " . (int) $mommy . "
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result2) > 0)
{
$context['avatar_sign_id'] = array();
while ($row_items = mysql_fetch_assoc($result2))
{
$context['avatar_sign_id'][] = array(
'filename' => $row_items['filename']
);
}
foreach ($context['avatar_sign_id'] as $avatar_item)
{
$context['filename_avatar'] = $avatar_item['filename'];
}
}
unset($mommy);
mysql_free_result($result);
mysql_free_result($result2);
}
function signature()
{
global $context, $settings, $modSettings, $db_prefix;
$lemo = '';
$img_url = $settings['default_theme_url'];
$membername = $context['membername'];
$posts = $context['posts'];
if ($context['filename_avatar'] != '')
{
$lemo = $context['filename_avatar'];
}
else {
$lemo = '';
}
$avatar = $context['avatar'];
$gender = $context['gender'];
$money = $context['money'];
if (preg_match( '/Male/', $gender))
{
$gender = "male";
$img_gender = "$img_url/images/Male.gif";
}
elseif (preg_match( '/Female/', $gender)) {
$gender = "female";
$img_gender = "$img_url/images/Female.gif"; }
else {$gender = "n/a"; $img_gender = "$img_url/images/star.gif";}
$karmaBad = $context['karmaBad'];
$karmaGood = $context['karmaGood'];
if ($modSettings['karmaMode'] == '1')
{
$karma = $karmaGood - $karmaBad;
} elseif ($modSettings['karmaMode'] == '2')
{
$karma = '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif ($modSettings['karmaMode'] == '0')
{
$karma = 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++
$backimg = "$img_url/images/sign.png"; // or where you want
$noavatar = "$img_url/images/noavatar.png"; // or where you want
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
$set_gender_style = 1; // 0 text , 1 image
$set_gender_height = -92; //move gender up/down
$set_gender_width = -230; //move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++
if ($avatar != '') {$avatar = $avatar;}
else {$avatar = $noavatar;}
if ($lemo != '') { $ext = substr(strrchr($lemo, '.'), 1); }
else {$ext = substr(strrchr($avatar, '.'), 1);}
unset($lemo);
if ($ext == 'png') {$img_bgr = imagecreatefrompng($avatar); }
elseif ($ext == 'jpg') {$img_bgr = imagecreatefromjpeg($avatar); }
elseif ($ext == 'gif') {$img_bgr = imagecreatefromgif($avatar); }
else die();
$size = getimagesize($backimg);
if ($set_gender_style == 1) {
$img_bgr_gender = imagecreatefromgif($img_gender);
$image_width_gender = imagesx($img_bgr_gender);
$image_height_gender = imagesy($img_bgr_gender);
$dest_x_gender = $size[0] - $image_width_gender + $set_gender_width;
$dest_y_gender = $size[1] - $image_height_gender + $set_gender_height;
}
$image_width = imagesx($img_bgr);
$image_height = imagesy($img_bgr);
//______________avatar width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
{
$set_avatar_width = $set_avatar_width + (($image_width - 101) * 0.35);
$set_avatar_height = $set_avatar_height + (($image_height - 101) * 0.35);
}
else { die();}
$image = imagecreatetruecolor($image_width, $image_height);
$image = imagecreatefrompng($backimg);
$dest_x = $size[0] - $image_width + $set_avatar_width;
$dest_y = $size[1] - $image_height + $set_avatar_height;
imagecopymerge($image, $img_bgr, $dest_x, $dest_y, 0, 0, $image_width, $image_height, 100);
if ($set_gender_style == 1) {
imagecopymerge($image, $img_bgr_gender, $dest_x_gender, $dest_y_gender, 0, 0, $image_width_gender, $image_height_gender, 100);
}
$green = ImageColorAllocate ($image, 23, 124, 17);
$blue = ImageColorAllocate ($image, 0, 0, 255);
$red = ImageColorAllocate ($image, 255, 0, 0);
$white = ImageColorAllocate ($image, 255, 255, 255);
$black = ImageColorAllocate ($image, 0, 0, 0);
ImageString($image, 4, 20, 35, "Posts: $posts", $black);
ImageString($image, 4, 20, 51, "Karma: $karma", $black);
if ($set_gender_style == 0) {
ImageString($image, 5, 31, 4, "$membername", $black);
ImageString($image, 4, 20, 66, "Gender: $gender", $black);
ImageString($image, 4, 20, 81, "Money: $money", $black);
} else {
ImageString($image, 5, 44, 4, "$membername", $black);
ImageString($image, 4, 20, 66, "Money: $money", $black);
}
header("Content-Type: image/png");
$php = PHP_VERSION;
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($image,null,9,null);
}
else {
Imagepng($image,null,90,null);
}
ImageDestroy ($image);
ImageDestroy ($img_bgr);
}
?>
Wow, Thanks
You completely freaking rock! This is actually somthing that I have been trying to get for along time now... thanks so much :)
I also figured out most of the color problem, I beleive its due to a faulty PNG in the avatar.
I still cant get the .png extension to work, and the Karma displays oddly but still!!!!
Quote from: Embrace on October 16, 2007, 09:35:33 AM
I still cant get the .png extension to work
open your
.httacces & add:
RewriteEngine On
RewriteRule sign.png /your.folder.of/sign.php
sign = whatever name
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fasignset.png%3Fu%3D1&hash=985a83e7d6d2cb0467b3ae80d66808df9615f29a)
Quote from: Embrace on October 16, 2007, 09:35:33 AM?
and the Karma displays oddly but still!!!!
Do you want your Karma like this ->
Karma: 223 instead
Karma: +223 / -223 ???????????????
Well for the karma I would like it to display the correct values :P
Karma: +54/-3
instead of
Karma +54/-54
That rewrite worked, im guessing that there is no easy way to make it so its somthing like
www.knightsofnight.com/embracesig.png?
Quote from: Embrace on October 16, 2007, 11:23:58 PM
Well for the karma I would like it to display the correct values :P
Karma: +54/-3
instead of
Karma +54/-54
Oh, sorry the problem was:
$context['karmaBad'] = $item_comm['lbuser']['karma']['good'];Correct
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];all scripts updated now. Thank you.
Quote from: Embrace on October 16, 2007, 11:23:58 PM
guessing that there is no easy way to make it so its somthing like
where is the trouble now?
Quote from: brianjw on October 15, 2007, 10:06:42 AM
For the arcade, can you make it display the latest 4 games played ONLY and show them in images (no text for the arcade).
My opinion is that these thumbsnails are too tiny after the resizing. Text is much better.
no real trouble I would just like the .png to be the ending of the url, so I could use the image on other sites that do not use smf :)
Quote from: Embrace on October 17, 2007, 08:52:29 AM
no real trouble I would just like the .png to be the ending of the url, so I could use the image on other sites that do not use smf :)
Find
if ($_GET['u'] >= 1)
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : die();
else die();
replace
$id_mem = 1;
where $id_mem = your id
run as sign.png
Ok so I would have to customize that for every member than?
No problem though, sounds like a good admin only thing :P Thanks!
Quote from: Embrace on October 17, 2007, 09:43:56 AM
Ok so I would have to customize that for every member than?
No problem though, sounds like a good admin only thing :P Thanks!
unfortunately... just one user.
Quote from: sebastian on October 17, 2007, 01:29:53 AM
My opinion is that these thumbsnails are too tiny after the resizing. Text is much better.
Could you make one anyway? As a test. It's like putting avatars on the image except it shows smaller images for the latest 4 (can be changed) played arcade games.
If it is something you still would rather not do... ($$$)
EDITWhat would I do to put the color, "#e1e1e1" into the code so I can do like $grey (never mind, I figured it out using photoshop)
--edit 2--
How and where would I make the avatar smaller in size to fit the signature?
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.gamerzgarage.com%2Fsig.php%3Fu%3D1&hash=3d98bf3312729b456b2040e128f4a6236ff0654e)
and...
On my website there is a ™ displayed after Tuxie so it would appear as Tuxie™ normally. Well the signature seems not be recognizing symbols and is showing
â ˘ instead. Any idea why and how to fix this? Thanks!
Edit 3I am trying to add an admin function part to this. I have been successful. The only problem I am getting is getting the modsettings functions to work on sig.php -
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else die();
error_reporting(E_ALL ^ E_NOTICE);
getinfos();
signature();
function getinfos()
{
global $context, $db_prefix, $memberContext;
$mommy = '';
if ($_GET['u'] >= 1)
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : die();
else die();
$result = db_query("
SELECT memberName
FROM {$db_prefix}members
WHERE ID_MEMBER = " . (int) $id_mem . "
AND is_activated = 1
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result) > 0)
{
$mprofile[] = (int) $id_mem;
loadMemberData($mprofile, false, 'profile');
foreach ($mprofile as $profile)
{
loadMemberContext($profile);
}
$context['item_comms'] = array();
$context['item_comms'][] = array(
'lbuser' => $memberContext[$id_mem]
);
foreach ($context['item_comms'] as $item_comm)
{
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
}
} else die();
$mommy = isset($context['avatar']) ? $context['avatar'] : '';
$mommy = preg_split('/;/',$mommy, -1, PREG_SPLIT_OFFSET_CAPTURE);
$mommy = $mommy [1][0];
$mommy = trim(substr(strrchr($mommy, '='), 1));
$result2 = db_query("
SELECT filename
FROM {$db_prefix}attachments
WHERE ID_ATTACH = " . (int) $mommy . "
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result2) > 0)
{
$context['avatar_sign_id'] = array();
while ($row_items = mysql_fetch_assoc($result2))
{
$context['avatar_sign_id'][] = array(
'filename' => $row_items['filename']
);
}
foreach ($context['avatar_sign_id'] as $avatar_item)
{
$context['filename_avatar'] = $avatar_item['filename'];
}
}
unset($mommy);
mysql_free_result($result);
mysql_free_result($result2);
}
function signature()
{
global $context, $settings, $modSettings, $db_prefix;
$lemo = '';
$img_url = $settings['default_theme_url'];
$membername = $context['membername'];
$posts = $context['posts'];
if ($context['filename_avatar'] != '')
{
$lemo = $context['filename_avatar'];
}
else {
$lemo = '';
}
$avatar = $context['avatar'];
$gender = $context['gender'];
if (preg_match( '/Male/', $gender))
{
$gender = "male";
$img_gender = "$img_url/images/Male.gif";
}
elseif (preg_match( '/Female/', $gender)) {
$gender = "female";
$img_gender = "$img_url/images/Female.gif"; }
else {$gender = "n/a"; $img_gender = "$img_url/images/star.gif";}
$karmaBad = $context['karmaBad'];
$karmaGood = $context['karmaGood'];
if ($modSettings['karmaMode'] == '1')
{
$karma = $karmaGood - $karmaBad;
} elseif ($modSettings['karmaMode'] == '2')
{
$karma = '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif ($modSettings['karmaMode'] == '0')
{
$karma = 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++
$backimg = "$img_url/images/sign.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/sign.png
$noavatar = "$img_url/images/noavatar.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/noavatar.png
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
$set_gender_style = 0; // 0 text , 1 image
$set_gender_height = -92; //move gender up/down
$set_gender_width = -230; //move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++
if ($avatar != '') {$avatar = $avatar;}
else {$avatar = $noavatar;}
if ($lemo != '') { $ext = substr(strrchr($lemo, '.'), 1); }
else {$ext = substr(strrchr($avatar, '.'), 1);}
unset($lemo);
if ($ext == 'png') {$img_bgr = imagecreatefrompng($avatar); }
elseif ($ext == 'jpg') {$img_bgr = imagecreatefromjpeg($avatar); }
elseif ($ext == 'gif') {$img_bgr = imagecreatefromgif($avatar); }
else die();
$size = getimagesize($backimg);
if ($set_gender_style == 1) {
$img_bgr_gender = imagecreatefromgif($img_gender);
$image_width_gender = imagesx($img_bgr_gender);
$image_height_gender = imagesy($img_bgr_gender);
$dest_x_gender = $size[0] - $image_width_gender + $set_gender_width;
$dest_y_gender = $size[1] - $image_height_gender + $set_gender_height;
}
$image_width = imagesx($img_bgr);
$image_height = imagesy($img_bgr);
//______________avatar width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
{
$set_avatar_width = $set_avatar_width + (($image_width - 101) * 0.35);
$set_avatar_height = $set_avatar_height + (($image_height - 101) * 0.35);
}
else { die();}
$image = imagecreatetruecolor($image_width, $image_height);
$image = imagecreatefrompng($backimg);
$dest_x = $size[0] - $image_width + $set_avatar_width;
$dest_y = $size[1] - $image_height + $set_avatar_height;
imagecopymerge($image, $img_bgr, $dest_x, $dest_y, 0, 0, $image_width, $image_height, 100);
if ($set_gender_style == 1) {
imagecopymerge($image, $img_bgr_gender, $dest_x_gender, $dest_y_gender, 0, 0, $image_width_gender, $image_height_gender, 100);
}
$green = ImageColorAllocate ($image, 23, 124, 17);
$blue = ImageColorAllocate ($image, 0, 0, 255);
$red = ImageColorAllocate ($image, 255, 0, 0);
$white = ImageColorAllocate ($image, 255, 255, 255);
$black = ImageColorAllocate ($image, 0, 0, 0);
ImageString($image, 4, 20, 35, "'. $modSettings['sig_posts'] .': $posts", $black);
ImageString($image, 4, 20, 51, "'. $modSettings['sig_karma'] .': $karma", $black);
if ($set_gender_style == 0) {
ImageString($image, 5, 55, 4, "$membername", $grey);
ImageString($image, 4, 20, 66, "'. $modSettings['sig_gender'] .': $gender", $black);
} else {ImageString($image, 5, 55, 4, "$membername", $black);}
header("Content-Type: image/png");
$php = PHP_VERSION;
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($image,'',9);
}
else {
Imagepng($image,'',90);
}
ImageDestroy ($image);
ImageDestroy ($img_bgr);
}
?>
mainly these codes are the problem (but how do I keep them and get rid of the following error):
ImageString($image, 4, 20, 35, "'. $modSettings['sig_posts'] .': $posts", $black);
ImageString($image, 4, 20, 51, "'. $modSettings['sig_karma'] .': $karma", $black);
if ($set_gender_style == 0) {
ImageString($image, 5, 55, 4, "$membername", $grey);
ImageString($image, 4, 20, 66, "'. $modSettings['sig_gender'] .': $gender", $black);
} else {ImageString($image, 5, 55, 4, "$membername", $black);}
Quote
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/b/j/w/bjwilson/html/test/sig.php on line 202
also is alright if I make this into a mod, if I display all credits mainly to you.
-----
Brianjw
Quote from: brianjw on October 18, 2007, 05:46:21 PM
On my website there is a ™ displayed after Tuxie so it would appear as Tuxie™ normally. Well the signature seems not be recognizing symbols and is showing â ˘ instead. Any idea why and how to fix this?
You need
True Type Font. This is also usefull for Non English Characters.
Upload your ttf font.add after $black = ImageColorAllocate ($image, 0, 0, 0);
this$font = 'fonts/somefont.TTF'; // change your font path and name here
findImageString($image, 5, 31, 4, "$membername", $black);
replace imagettftext($image, 12, 0, 31, 17, $black, $font, "$membername");
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fasignset.png%3Fu%3D1&hash=985a83e7d6d2cb0467b3ae80d66808df9615f29a)
Quote from: brianjw on October 18, 2007, 05:46:21 PM
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in
$sig_posts = $modSettings['sig_posts'];
$sig_karma = $modSettings['sig_karma'];
$sig_gender = $modSettings['sig_gender'];
ImageString($image, 4, 20, 35, "$sig_posts: $posts", $black);
ImageString($image, 4, 20, 51, "$sig_karma: $karma", $black);
if ($set_gender_style == 0) {
ImageString($image, 5, 31, 4, "$membername", $grey);
ImageString($image, 4, 20, 66, "$sig_gender: $gender", $black);
} else {ImageString($image, 5, 44, 4, "$membername", $black);}
Quote from: brianjw on October 18, 2007, 05:46:21 PM
also is alright if I make this into a mod, if I display all credits mainly to you
Yes.
signature arcade last games thumbs
| (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.remorse.gr%2Fsmfiles%2Fnothumb.gif&hash=2855f4d9d9d212190c6343da3392542199695214) |
Copy
nothumb.gif into
./Games folder.
Some thumbnails is defectivelly.
Settings$set_arcade_style = 1; //0 text , 1 image
$context['set_arcade_game_folder'] = 'Games'; //without any /
$context['set_arcade_height'] = 3; //move arcade up/down
$context['set_arcade_width'] = 67; //move arcade left/right
$context['set_thumb_width'] = 40; //set thumb width
$context['set_thumb_height'] = 40; //set thumb height
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else die();
getinfos();
signature();
function getinfos()
{
global $context, $db_prefix, $memberContext;
$mommy = '';
if ($_GET['u'] >= 1)
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : die();
else die();
$result = db_query("
SELECT memberName
FROM {$db_prefix}members
WHERE ID_MEMBER = " . (int) $id_mem . "
AND is_activated = 1
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result) > 0)
{
$mprofile[] = (int) $id_mem;
loadMemberData($mprofile, false, 'profile');
foreach ($mprofile as $profile)
{
loadMemberContext($profile);
}
$context['item_comms'] = array();
$context['item_comms'][] = array(
'lbuser' => $memberContext[$id_mem]
);
foreach ($context['item_comms'] as $item_comm)
{
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
}
} else die();
$mommy = isset($context['avatar']) ? $context['avatar'] : '';
$mommy = preg_split('/;/',$mommy, -1, PREG_SPLIT_OFFSET_CAPTURE);
$mommy = $mommy [1][0];
$mommy = trim(substr(strrchr($mommy, '='), 1));
$result2 = db_query("
SELECT filename
FROM {$db_prefix}attachments
WHERE ID_ATTACH = " . (int) $mommy . "
LIMIT 1", __FILE__, __LINE__);
if (db_affected_rows($result2) > 0)
{
$context['avatar_sign_id'] = array();
while ($row_items = mysql_fetch_assoc($result2))
{
$context['avatar_sign_id'][] = array(
'filename' => $row_items['filename']
);
}
foreach ($context['avatar_sign_id'] as $avatar_item)
{
$context['filename_avatar'] = $avatar_item['filename'];
}
}
unset($mommy);
ArcadeLatestGames(4, 0, $id_mem);
$y = 0;
$context['arcade']['latest_games'] = ArcadeLatestGames(4, 0, $id_mem);
if (count($context['arcade']['latest_games']) > 0)
foreach ($context['arcade']['latest_games'] as $game) {
$context['arcadelast'][$y] .= $game['name'].'-'.$game['score'].'-'.$game['position'];
$context['arcade_thumbs'][$y] = $game['thumbnail'];
$y++; }
mysql_free_result($result);
mysql_free_result($result2);
}
function signature()
{
global $context, $settings, $modSettings, $db_prefix, $boardurl;
$lemo = '';
$img_url = $settings['default_theme_url'];
$membername = $context['membername'];
$posts = $context['posts'];
if ($context['filename_avatar'] != '')
{
$lemo = $context['filename_avatar'];
}
else {
$lemo = '';
}
$avatar = $context['avatar'];
$gender = $context['gender'];
$arcade1 = $context['arcadelast'][0];
$arcade2 = $context['arcadelast'][1];
$arcade3 = $context['arcadelast'][2];
$arcade4 = $context['arcadelast'][3];
$arcadethump1 = $context['arcade_thumbs'][0];
$arcadethump2 = $context['arcade_thumbs'][1];
$arcadethump3 = $context['arcade_thumbs'][2];
$arcadethump4 = $context['arcade_thumbs'][3];
$arcade_thumb = $boardurl.'/'.$set_arcade_game_folder.'/'.$context['arcade_thumbs'][0];
if (preg_match( '/Male/', $gender))
{
$gender = "male";
$img_gender = "$img_url/images/Male.gif";
}
elseif (preg_match( '/Female/', $gender)) {
$gender = "female";
$img_gender = "$img_url/images/Female.gif"; }
else {$gender = "n/a"; $img_gender = "$img_url/images/star.gif";}
$karmaBad = $context['karmaBad'];
$karmaGood = $context['karmaGood'];
if ($modSettings['karmaMode'] == '1')
{
$karma = $karmaGood - $karmaBad;
} elseif ($modSettings['karmaMode'] == '2')
{
$karma = '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif ($modSettings['karmaMode'] == '0')
{
$karma = 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++
$backimg = "$img_url/images/sign.png"; // or where you want
$noavatar = "$img_url/images/noavatar.png"; // or where you want
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
$set_gender_style = 1; // 0 text , 1 image
$set_gender_height = -92; //move gender up/down
$set_gender_width = -230; //move gender left/right
$set_arcade_style = 1; //0 text , 1 image
$context['set_arcade_game_folder'] = 'Games'; //without any /
$context['set_arcade_height'] = 3; //move arcade up/down
$context['set_arcade_width'] = 67; //move arcade left/right
$context['set_thumb_width'] = 40; //set thumb width
$context['set_thumb_height'] = 40; //set thumb height
// Your settings +++++++++++++++++++++++++++++++++++
if ($avatar != '') {$avatar = $avatar;}
else {$avatar = $noavatar;}
if ($lemo != '') { $ext = substr(strrchr($lemo, '.'), 1); }
else {$ext = substr(strrchr($avatar, '.'), 1);}
unset($lemo);
if ($ext == 'png') {$img_bgr = imagecreatefrompng($avatar); }
elseif ($ext == 'jpg') {$img_bgr = imagecreatefromjpeg($avatar); }
elseif ($ext == 'gif') {$img_bgr = imagecreatefromgif($avatar); }
else die();
$size = getimagesize($backimg);
if ($set_gender_style == 1) {
$img_bgr_gender = imagecreatefromgif($img_gender);
$image_width_gender = imagesx($img_bgr_gender);
$image_height_gender = imagesy($img_bgr_gender);
$dest_x_gender = $size[0] - $image_width_gender + $set_gender_width;
$dest_y_gender = $size[1] - $image_height_gender + $set_gender_height;
}
$image_width = imagesx($img_bgr);
$image_height = imagesy($img_bgr);
//______________avatar width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
{
$set_avatar_width = $set_avatar_width + (($image_width - 101) * 0.35);
$set_avatar_height = $set_avatar_height + (($image_height - 101) * 0.35);
}
else { die();}
$context['image'] = imagecreatetruecolor($image_width, $image_height);
$context['image'] = imagecreatefrompng($backimg);
$dest_x = $size[0] - $image_width + $set_avatar_width;
$dest_y = $size[1] - $image_height + $set_avatar_height;
imagecopymerge($context['image'], $img_bgr, $dest_x, $dest_y, 0, 0, $image_width, $image_height, 100);
if ($set_gender_style == 1) {
imagecopymerge($context['image'], $img_bgr_gender, $dest_x_gender, $dest_y_gender, 0, 0, $image_width_gender, $image_height_gender, 100);
}
if ($set_arcade_style == 1) {
arcade_last_games ($arcadethump1 , 1);
arcade_last_games ($arcadethump2 , 43);
arcade_last_games ($arcadethump3 , 86);
arcade_last_games ($arcadethump4 , 129);
}
$green = ImageColorAllocate ($context['image'], 23, 124, 17);
$blue = ImageColorAllocate ($context['image'], 0, 0, 255);
$red = ImageColorAllocate ($context['image'], 255, 0, 0);
$white = ImageColorAllocate ($context['image'], 255, 255, 255);
$black = ImageColorAllocate ($context['image'], 0, 0, 0);
ImageString($context['image'], 4, 20, 32, "Posts: $posts", $black);
ImageString($context['image'], 4, 20, 48, "Karma: $karma", $black);
if ($set_arcade_style == 0) {
ImageString($context['image'], 2, 1, 67, "Arcade: $arcade1", $black);
ImageString($context['image'], 2, 1, 77, "Last 4: $arcade2", $black);
ImageString($context['image'], 2, 1, 87, "Played: $arcade3", $black);
ImageString($context['image'], 2, 1, 97, "Games : $arcade4", $black);
}
if ($set_gender_style == 0) {
ImageString($context['image'], 5, 31, 4, "$membername", $black);
ImageString($context['image'], 4, 20, 66, "Gender: $gender", $black);
} else {ImageString($context['image'], 5, 44, 4, "$membername", $black);}
header("Content-Type: image/png");
$php = PHP_VERSION;
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($context['image'],null,9,null);
}
else {
Imagepng($context['image'],null,90,null);
}
ImageDestroy ($context['image']);
ImageDestroy ($img_bgr);
}
function ArcadeLatestGames($count = 4, $start = 0, $mem_id = null)
{
global $context, $db_prefix;
$games = db_query("
SELECT game.gameName, game.thumbnail, score.score, score.position, score.endTime
FROM ({$db_prefix}arcade_scores AS score, {$db_prefix}arcade_games AS game)
WHERE score.ID_MEMBER = ". $mem_id ." AND score.ID_GAME = game.ID_GAME
ORDER BY endTime DESC
LIMIT $start,$count",__FILE__,__LINE__);
$data = array();
while ($game = mysql_fetch_assoc($games))
$data[] = array(
'name' => $game['gameName'],
'thumbnail' => $game['thumbnail'],
'score' => comma_format($game['score']),
'position' => ($game['position'])
);
return $data;
mysql_free_result($games);
}
function arcade_last_games ($game_name, $width_px)
{
global $context;
$image = $context['img_back'];
$img_thumb_exist = $context['set_arcade_game_folder'].'/'.$game_name;
$arcade_thumb = file_exists($img_thumb_exist) ? $arcade_thumb = $img_thumb_exist : $arcade_thumb = $context['set_arcade_game_folder'].'/nothumb.gif';
$dest_x_arcade_px = $width_px;
$img_bgr_arcade = imagecreatefromgif($arcade_thumb);
$image_width_arcade = imagesx($img_bgr_arcade);
$image_height_arcade = imagesy($img_bgr_arcade);
$dest_x_arcade = $context['set_arcade_height'] + $dest_x_arcade_px;
$dest_y_arcade = $context['set_arcade_width'];
$img_bgr_arcade_thumb = imagecreatetruecolor($context['set_thumb_width'], $context['set_thumb_height']);
imagecopyresized($img_bgr_arcade_thumb, $img_bgr_arcade, 0, 0, 0, 0, $context['set_thumb_width'], $context['set_thumb_height'], $image_width_arcade, $image_height_arcade);
imagecopymerge($context['image'], $img_bgr_arcade_thumb, $dest_x_arcade, $dest_y_arcade, 0, 0, $context['set_thumb_width'], $context['set_thumb_height'], 100);
}
?>
Thanks so much! I am not able to test it yet though! I will let you know if it works when I do :)
Can someone make a Mod, meaning i can automatically install it on SMF from Packages for SMF 1.1.4 PLEASE
Quote from: sunite on December 29, 2007, 12:54:26 PM
Can someone make a Mod, meaning i can automatically install it on SMF from Packages for SMF 1.1.4 PLEASE
Have you requested this in the correct area?
Quote from: sunite on December 29, 2007, 12:54:26 PM
Can someone make a Mod, meaning i can automatically install it on SMF from Packages for SMF 1.1.4 PLEASE
Too sophisticated. Simple make and upload your file.
when i go to:
http://mundo-se.com/foro/sign.php?u=1
appear:
QuoteWarning: imagecreatefrompng() [function.imagecreatefrompng (http://mundo-se.com/foro/function.imagecreatefrompng)]: URL file-access is disabled in the server configuration in /www/zzl.org/s/e/-/se-world/htdocs/foro/sign.php on line 157
Warning: imagecreatefrompng(http://mundo-se.com/foro/index.php?action=dlattach;attach=135;type=avatar) [function.imagecreatefrompng (http://mundo-se.com/foro/function.imagecreatefrompng)]: failed to open stream: no suitable wrapper could be found in /www/zzl.org/s/e/-/se-world/htdocs/foro/sign.php on line 157
Warning: getimagesize() [function.getimagesize (http://mundo-se.com/foro/function.getimagesize)]: URL file-access is disabled in the server configuration in /www/zzl.org/s/e/-/se-world/htdocs/foro/sign.php on line 162
Warning: getimagesize(http://mundo-se.com/foro/Themes/default/images/sign.png) [function.getimagesize (http://mundo-se.com/foro/function.getimagesize)]: failed to open stream: no suitable wrapper could be found in /www/zzl.org/s/e/-/se-world/htdocs/foro/sign.php on line 162
Warning: imagesx(): supplied argument is not a valid Image resource in /www/zzl.org/s/e/-/se-world/htdocs/foro/sign.php on line 172
Warning: imagesy(): supplied argument is not a valid Image resource in /www/zzl.org/s/e/-/se-world/htdocs/foro/sign.php on line 173
Very nice, thanks for the share.
@ Thank you Panzer-
@ NIBOGO
First delete all personal data.
Second try to set $set_gender_style = 0; // 0 text , 1 image
Your server probably does not allow remote connections. Try to use absolute paths.
example: Themes/default/images/male.gif instead http://www.mysite.com/Themes/default/male.gif
Line 88, add
global $context, $settings, $modSettings ,$boarddir;
Line 91, replace
$img_url = $boarddir.'/Themes/default';
So...
global $context, $settings, $modSettings, $boarddir;
$lemo = '';
$img_url = $boarddir.'/Themes/default';
hi all
i have a strange error..
when a user doesnt have avatar...all is correct.
but when i put a user with avatar....i get a white page with this message "No Extension"
Hello matasanos,
Can you give us your GD library info?
make a php file like this gdinfo.php
<?php
var_dump(gd_info());
?>
sebastian your code didnt work , i have another server and have the same error:
Warning: imagecreatefrompng() [function.imagecreatefrompng]: URL file-access is disabled in the server configuration in /home/.sauvignon/nibogo2/mundo-se.com/foro/archivo.php on line 157
Warning: imagecreatefrompng(http://www.mundo-se.com/foro/avatars/Tux/Tux1.png) [function.imagecreatefrompng]: failed to open stream: no suitable wrapper could be found in /home/.sauvignon/nibogo2/mundo-se.com/foro/archivo.php on line 157
Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in /home/.sauvignon/nibogo2/mundo-se.com/foro/archivo.php on line 161
Warning: getimagesize(http://www.mundo-se.com/foro/Themes/default/images/sign.png) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in /home/.sauvignon/nibogo2/mundo-se.com/foro/archivo.php on line 161
Warning: imagesx(): supplied argument is not a valid Image resource in /home/.sauvignon/nibogo2/mundo-se.com/foro/archivo.php on line 171
Warning: imagesy(): supplied argument is not a valid Image resource in /home/.sauvignon/nibogo2/mundo-se.com/foro/archivo.php on line 172
Hello again NIBOGO,
And again, your server does not allow remote connections. Try to use absolute paths.
Example ->
avatars/Tux/Tux1.png instead
http://www.mundo-se.com/foro/avatars/Tux/Tux1.png
So...Gooo to function signature()
Search first
global $context, $settings, $modSettings, $db_prefix
replace
global $context, $settings, $modSettings, $db_prefix, $boardurl;
Search second
$avatar = $context['avatar'];
replace
$avatar = $context['avatar'];
$avatar = str_replace($boardurl.'/', '', $avatar);
Your $boardurl = http://www.mundo-se.com/foro/
Your image link is = http://www.mundo-se.com/foro/avatars/Tux/Tux1.png
Result
absolute path = avatars/Tux/Tux1.png
I hope you find this useful.
I have saved the signature_info.php in the directory along with the SSI.php.
and the image signinfo.pnp in /themes/default/images
the image location is http://mysite.com/themes/default/images/signinfo.png
QuoteNow you said:
Finally set your signature -->
Code: [img]http://mydomain/signinfo.png[/img]
wont this be http://mysite.com/themes/default/images/signinfo.png?
and in the signature_info.php won't the following code ie
$image = "$img_url/images/signature_info.png"; // or where you want
be
$image = "$img_url/images/signinfo.png"; //
??
Please advice as I couldnt get the image coming up.
If the image is located in http://mysite.com/themes/default/images/signinfo.png then the code would be:
$image = "$img_url/images/signinfo.png"; // or where you want
so you were correct. :)
Thanks for the reply.
What about the signature,
will it be [img]http://mydomain/signinfo.png[/img]
OR
[img]http://mydomain/themes/default/images/signinfo.png[/img]
??
The signature will be
[img]http://mydomain/signature_info.php[/img]
The php code displays the picture. The picture that is in the location is just a background image for the dynamic signature. The dynamic signature is generated and rendered in the php file so you'd link to the php file.
brianjw... thank you so much.. i will give it a shot and i will come back if i have any issue.
Quote from: sebastian on May 03, 2008, 02:15:20 AM
Hello again NIBOGO,
And again, your server does not allow remote connections. Try to use absolute paths.
Example ->
avatars/Tux/Tux1.png instead
http://www.mundo-se.com/foro/avatars/Tux/Tux1.png (http://www.mundo-se.com/foro/avatars/Tux/Tux1.png)
So...Gooo to function signature()
Search first
global $context, $settings, $modSettings, $db_prefix
replace
global $context, $settings, $modSettings, $db_prefix, $boardurl;
Search second
$avatar = $context['avatar'];
replace
$avatar = $context['avatar'];
$avatar = str_replace($boardurl.'/', '', $avatar);
Your $boardurl = http://www.mundo-se.com/foro/ (http://www.mundo-se.com/foro/)
Your image link is = http://www.mundo-se.com/foro/avatars/Tux/Tux1.png (http://www.mundo-se.com/foro/avatars/Tux/Tux1.png)
Result
absolute path = avatars/Tux/Tux1.png
I hope you find this useful.
Thanks for your help but didnt work i do the two modifications :'( :'( :'(
This mod is not for me :( :(
I'm trying to have the Greenwich under my local time and I moved the code around but it doesnt seem tp bump down. What gives... this is the code I have and what that code puts out as my image. Also, no biggie but more curious on this one. I noticed that the online members is also counting guests, is there anyway to not have it count guests ?
Edit: What needs to be added to add a Newest Member line ? I was thinking I could just take out the Greenwich Time and use that empty space for a Newest Member line.
Edit: All problems being fixed right now, only takes some playing around with to learn on your own, Thx ;-)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.eojmarket.com%2Fsigninfo.php&hash=6e254441c688696f659709c2cdaa87a4e017f5a3)
Code emoved...
Is there a way to automatically pull the forum version in my case 1.1.5 so it doesnt need to be manually edited upon forum updates etc. ?
Unfortunately, no!!! Remove this line.
Quote from: sebastian on August 24, 2008, 05:32:06 AM
Unfortunately, no!!! Remove this line.
Just figured I'd ask, woulda been kinda cool though.
Also, one quick question... if there a way to make smething hyperlink on it like the sites web address ? I trired a few things that didnt wor, hope the question makes sense.
Hi, bad news again. String only.
This pops up from time to time, I was curious if you know whats causing it. Like is there a problem with the code / image or just something configured wrong in my php.ini file.
[02-Nov-2008 11:45:09] PHP Warning: imagecreatefrompng() [function.imagecreatefrompng]: Cannot read image data in /home/eojmarke/public_html/signinfo3.php on line 29
[02-Nov-2008 11:45:09] PHP Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/eojmarke/public_html/signinfo3.php on line 30
[02-Nov-2008 11:45:09] PHP Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/eojmarke/public_html/signinfo3.php on line 31
[02-Nov-2008 11:45:09] PHP Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/eojmarke/public_html/signinfo3.php on line 32
[02-Nov-2008 11:45:09] PHP Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/eojmarke/public_html/signinfo3.php on line 33
[02-Nov-2008 11:45:09] PHP Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/eojmarke/public_html/signinfo3.php on line 34
[02-Nov-2008 11:45:09] PHP Warning: imagestring(): supplied argument is not a valid Image resource in /home/eojmarke/public_html/signinfo3.php on line 37
[02-Nov-2008 11:45:09] PHP Warning: imagestring(): supplied argument is not a valid Image resource in /home/eojmarke/public_html/signinfo3.php on line 38
[02-Nov-2008 11:45:09] PHP Warning: imagestring(): supplied argument is not a valid Image resource in /home/eojmarke/public_html/signinfo3.php on line 39
[02-Nov-2008 11:45:09] PHP Warning: imagestring(): supplied argument is not a valid Image resource in /home/eojmarke/public_html/signinfo3.php on line 40
[02-Nov-2008 11:45:09] PHP Warning: imagestring(): supplied argument is not a valid Image resource in /home/eojmarke/public_html/signinfo3.php on line 41
[02-Nov-2008 11:45:09] PHP Warning: imagepng(): supplied argument is not a valid Image resource in /home/eojmarke/public_html/signinfo3.php on line 44
[02-Nov-2008 11:45:09] PHP Warning: imagedestroy(): supplied argument is not a valid Image resource in /home/eojmarke/public_html/signinfo3.php on line 47
Hello,
This code is very simple. I have two thoughts about that errors.
1. For some reason imagecreatefrompng function fails to read your source png image file.
2. The Imagecreatefrompng function needs GD library to generate this png image.
So something relative to GD library occurs this error.
Quote from: sebastian on November 02, 2008, 10:35:14 PM
Hello,
This code is very simple. I have two thoughts about that errors.
1. For some reason imagecreatefrompng function fails to read your source png image file.
2. The Imagecreatefrompng function needs GD library to generate this png image.
So something relative to GD library occurs this error.
Well, I do have GD and as far as IO can tell its fine.
http://www.eojmarket.com/gd_info.php
Edit: As far as I know the "script" is acting fine as you can see from my signature.
Quote: As far as I know the "script" is acting fine as you can see from my signature.
Hi,
I did not say that it does not exist, obviously you have GD library already.
Try to replace the png file or try to handle the error.
After
$im = imagecreatefrompng($image);
Add
if (!$im)
{
$im = imagecreatetruecolor(385, 110); // x-coordinate, y-coordinate
//default is black but if you want another background color uncheck
//imagefill($im, 0, 0, 255, 0, 0); // red etc
}
Well I put in the changes, so heres hoping it works heh.
The error itself didnt seem to be messing with anything it just kept creating an error file which is annoying. Either way Thx, I'll post back with info to let you know if it work or not ;-)
This seems to be the only thing showing up now after adding your "edits"
[03-Nov-2008 11:43:06] PHP Warning: imagecreatefrompng() [function.imagecreatefrompng]: Cannot read image data in /home/eojmarke/public_html/signinfo3.php on line 29
Solution 1
Try to use absolute paths.
->: Forum_directory/Themes/default/images/signature.png instead http://www.mysite.com/Forum_directory/Themes/default/images/signature.png
Replace
$img_url = $settings['default_theme_url'];
With
$img_url = "your_forum_directory/Themes/default/";
Solution 2
Your background image is black... so...
Delete 2 lines
$image = "$img_url/images/signature_info.png"; // or where you want
$im = imagecreatefrompng($image);
Sorry for the trouble, I'll give number 2 a shot first so I dont have to mess with paths. If that fixes it great if not then I'll try number one. Either way ty for the help, one thing I am glad for is that I atleast got the status image working because I remember trying this about 2 yrs ago or something like that and got frustrated as hell because I couldnt get it to work heh.
Edit: Actually, do I need to do both solutions or just one ?
Edit 2: Come to think of it wont deleting that line make the "script" stop working. I ask becaue one of the lines you say to delete appears to be the line that calls the image.
QuoteActually, do I need to do both solutions or just one ?
Just one, Solution 2 is the best for you now.
QuoteCome to think of it wont deleting that line make the "script" stop working. I ask becaue one of the lines you say to delete appears to be the line that calls the image
There is no problem because the next lines solve this issue.
if (!$im)
{
$im = imagecreatetruecolor(385, 110); // x-coordinate, y-coordinate
//default is black but if you want another background color uncheck
//imagefill($im, 0, 0, 255, 0, 0); // red etc
}
...also...
QuoteI noticed that the online members is also counting guests, is there anyway to not have it count guests
Remove
$result = db_query("
SELECT COUNT(session)
FROM {$db_prefix}log_online", __FILE__, __LINE__);
list ($context['users_online']) = mysql_fetch_row($result);
Add
$result = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}log_online", __FILE__, __LINE__);
$context['users_online'] = 0;
while ($row = mysql_fetch_assoc($result))
{
if (!empty($row['ID_MEMBER']))
{
$context['users_online']++;
continue;
}
}
Quote from: sebastian on November 03, 2008, 03:36:30 PMQuoteCome to think of it wont deleting that line make the "script" stop working. I ask becaue one of the lines you say to delete appears to be the line that calls the image
There is no problem because the next lines solve this issue.
if (!$im)
{
$im = imagecreatetruecolor(385, 110); // x-coordinate, y-coordinate
//default is black but if you want another background color uncheck
//imagefill($im, 0, 0, 255, 0, 0); // red etc
}
Well, the thing is I use three variations of this script to acconodate a few people... look here.
http://www.eojmarket.com/index.php?topic=272.msg2412#msg2412
Edit: Also solution 1 didnt seem to work as I'm till getting the below. So it would seem that solution two is my best option but since I use three varations of the script I dont see how removing the image line would fix the one problem without creationg others due to the three versions of this that I have.
[03-Nov-2008 11:43:06] PHP Warning: imagecreatefrompng() [function.imagecreatefrompng]: Cannot read image data in /home/eojmarke/public_html/signinfo3.php on line 29
Sebastian any update for smf 2.0???
@NIBOGO
Signature info stats for SMF 2.0 Beta already exists. Look into first post.
(search signature_info.php NO_FONTS (SMF 2.x.x))
@MoreBloodWine
Upload a jpeg file. (signature_info.jpg)
Find
$image = "$img_url/images/signature_info.png"; // or where you want
$im = imagecreatefrompng($image);
Replace
$image = "$img_url/images/signature_info.jpg"; // or where you want
$im = imagecreatefromjpeg($image);
Find
header("Content-Type: image/png");
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($im,null,9,null);
}
else {Imagepng($im,null,90,null);}
Replace
header("Content-Type: image/jpeg");
Imagejpeg($im, null, 90);
Quote from: sebastian on November 03, 2008, 10:50:55 PM
@NIBOGO
Signature info stats for SMF 2.0 Beta already exists. Look the first post.
(search signature_info.php NO_FONTS (SMF 2.x.x))
@MoreBloodWine
Upload a jpeg file.
Find
$image = "$img_url/images/signature_info.png"; // or where you want
$im = imagecreatefrompng($image);
Replace
$image = "$img_url/images/signature_info.jpg"; // or where you want
$im = imagecreatefromjpeg($image);
Find
header("Content-Type: image/png");
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($im,null,9,null);
}
else {Imagepng($im,null,90,null);}
Replace
header("Content-Type: image/jpeg");
Imagejpeg($im, null, 90);
Thx, I'll convert my "image" to a jpg and make your changes and that should fix whatever associated errors I'm having without affecting the three version of this I have. Either way I'll post back with the news ;-)
That last change of yours I'm unsure what to do exactly. I only say that because that last bit of code I changed once before to fix something I read in this 9 page thread. Anyway, this is what the last bit of code looks like that comes before the ?>
header("Content-Type: image/png");
Imagepng($im,'',9);
// if PHP v5.2.6 ++
// Imagepng($im,'',9);
ImageDestroy ($im);
Signature Info Stats Jpeg Version
<?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);
$img_url = $settings['default_theme_url'];
$forum_name = $context['forum_name'];
$forum_url = $boardurl;
$now = forum_time();
$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'];
$last_member = $context['common_stats']['latest_member']['name'];
$image = "$img_url/images/signature_info.jpg"; // or where you want
$im = imagecreatefromjpeg($image);
if (!$im)
{
$im = imagecreatetruecolor(385, 110); // x-coordinate, y-coordinate
//default is black but if you want another background color uncheck
//imagefill($im, 0, 0, 255, 0, 0); // red etc
}
$green = ImageColorAllocate ($im, 23, 124, 17);
$blue = ImageColorAllocate ($im, 0, 0, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
ImageString($im, 3, 10, 1, "$image", $blue);
ImageString($im, 3, 94, 15, "$forum_url", $blue);
ImageString($im, 3, 90, 31, "$timel Local Time", $green);
ImageString($im, 3, 90, 46, "Total Members : $total_members", $red);
ImageString($im, 3, 90, 61, "Online Members: $online_members", $red);
ImageString($im, 3, 220, 61, "Total Posts: $total_posts", $red);
ImageString($im, 3, 220, 46, "Total Topics: $total_topics", $red);
ImageString($im, 3, 90, 76, "Latest Member: $last_member ", $red);
header("Content-Type: image/jpeg");
Imagejpeg($im, null, 90);
ImageDestroy ($im);
}
?>
Sebastian excuse me again ,
I try the first code and everything is ok:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg361.imageshack.us%2Fimg361%2F103%2Fsignze0.png&hash=bb2e58c42b2c7228ad00ec011083493a196392e6)
But I try the code for every member in my localhost and I get this:
Warning: imagecreatefrompng(http://localhost/beta/Themes/Default/images/noavatar.png) [function.imagecreatefrompng]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/beta/firma.php on line 148
Warning: getimagesize(http://localhost/beta/Themes/Default/images/sign.png) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/beta/firma.php on line 153
Warning: imagesx(): supplied argument is not a valid Image resource in /var/www/beta/firma.php on line 163
Warning: imagesy(): supplied argument is not a valid Image resource in /var/www/beta/firma.php on line 164
What I can do?
Are the images actually in those locations? If so, are they CHMODDED to 777?
Quote from: sebastian on November 05, 2008, 04:42:44 AM
Quote from: brianjw on November 04, 2008, 10:18:25 PM
Are the images actually in those locations?
Fixed just change:
$backimg = "http://localhost/beta/Themes/Default/images/sign.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/sign.png
$noavatar = "http://localhost/beta/Themes/Default/images/noavatar.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/noavatar.png
to:
$backimg = "http://localhost/beta/Themes/default/images/sign.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/sign.png
$noavatar = "http://localhost/beta/Themes/default/images/noavatar.png"; // or where you want -> http://www.yourdomain.com/Themes/Default/images/noavatar.png
Works great really useful
OK!!!
Quote from: sebastian on November 03, 2008, 03:36:30 PM
...also...
QuoteI noticed that the online members is also counting guests, is there anyway to not have it count guests
Remove
$result = db_query("
SELECT COUNT(session)
FROM {$db_prefix}log_online", __FILE__, __LINE__);
list ($context['users_online']) = mysql_fetch_row($result);
Add
$result = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}log_online", __FILE__, __LINE__);
$context['users_online'] = 0;
while ($row = mysql_fetch_assoc($result))
{
if (!empty($row['ID_MEMBER']))
{
$context['users_online']++;
continue;
}
}
Hi Sebastian ,
your code works great for the stats page. If I wanted to not show guests on the main page under "Users Online" what would I need to change to accomplish that?
Quote from: Zeebra on December 19, 2008, 02:36:05 PM
If I wanted to not show guests on the main page under "Users Online" what would I need to change to accomplish that?
Hi Zeebra,
Do you mean 'The main page' of your forum? If so...
Backup and open
your_forum_path/Themes/Your_theme/BoardIndex.template.phpFindecho '
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
Replaceecho '
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
Quote from: sebastian on December 22, 2008, 07:35:04 AM
Quote from: Zeebra on December 19, 2008, 02:36:05 PM
If I wanted to not show guests on the main page under "Users Online" what would I need to change to accomplish that?
Hi Zeebra,
Do you mean 'The main page' of your forum? If so...
Backup and open your_forum_path/Themes/Your_theme/BoardIndex.template.php
Find
echo '
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
Replace
echo '
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
Thank you again Sebastian! That works great on the main page of the forum. One more instance. When I click on the link for "x Users" on the main page it takes me to a "Who's Online" page "index.php?action=who"...that still lists Guests. Where is the code to modify for that last page?
Quote from: Zeebra on December 22, 2008, 10:55:59 AM
When I click on the link for "x Users" on the main page it takes me to a "Who's Online" page "index.php?action=who"...that still lists Guests. Where is the code to modify for that last page?
Same file BoardIndex.template.php
Findecho '
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
Replaceecho '
', $context['show_who'] ? '' : '', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
Find echo $context['show_who'] ? '</a>' : '', '
<div class="smalltext">';
Replace echo $context['show_who'] ? '' : '', '
<div class="smalltext">';
Quote from: sebastian on December 23, 2008, 12:57:51 AM
Quote from: Zeebra on December 22, 2008, 10:55:59 AM
When I click on the link for "x Users" on the main page it takes me to a "Who's Online" page "index.php?action=who"...that still lists Guests. Where is the code to modify for that last page?
Same file BoardIndex.template.php
Find
echo '
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
Replace
echo '
', $context['show_who'] ? '' : '', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
Find
echo $context['show_who'] ? '</a>' : '', '
<div class="smalltext">';
Replace
echo $context['show_who'] ? '' : '', '
<div class="smalltext">';
I couldn't find the 2nd piece of code you listed. I found instead:
if ($context['show_who'])
echo '</a>';
echo '
<div class="smalltext">';
and I tried replacing it with your code but I still see "Guests" in the "Who's Online" section?
Quote from: Zeebra on December 23, 2008, 10:45:21 AM
and I tried replacing it with your code but I still see "Guests" in the "Who's Online" section?
OK I understood now.
Backup and open
your_forum_path/Themes/Your_theme/Who.template.phpFind if (!$member['is_guest'])
{
echo '
<div style="float: right; width: 14ex;">
', $context['can_send_pm'] ? '<a href="' . $member['online']['href'] . '" title="' . $member['online']['label'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $member['online']['image_href'] . '" alt="' . $member['online']['text'] . '" align="middle" />' : $member['online']['text'], $context['can_send_pm'] ? '</a>' : '', '
', $member['icq']['link'], ' ', $member['msn']['link'], ' ', $member['yim']['link'], ' ', $member['aim']['link'], '
</div>';
}
echo '
<span', $member['is_hidden'] ? ' style="font-style: italic;"' : '', '>', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt[92] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', '</span>';
if (!empty($member['ip']))
echo '
(<a href="' . $scripturl . '?action=trackip;searchip=' . $member['ip'] . '" target="_blank">' . $member['ip'] . '</a>)';
echo '
</td>
<td nowrap="nowrap">', $member['time'], '</td>
<td>', $member['action'], '</td>
</tr>';
Replace if (!$member['is_guest'])
{
echo '
<div style="float: right; width: 14ex;">
', $context['can_send_pm'] ? '<a href="' . $member['online']['href'] . '" title="' . $member['online']['label'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $member['online']['image_href'] . '" alt="' . $member['online']['text'] . '" align="middle" />' : $member['online']['text'], $context['can_send_pm'] ? '</a>' : '', '
', $member['icq']['link'], ' ', $member['msn']['link'], ' ', $member['yim']['link'], ' ', $member['aim']['link'], '
</div>';
echo '
<span', $member['is_hidden'] ? ' style="font-style: italic;"' : '', '>', $member['is_guest'] ? '' : '<a href="' . $member['href'] . '" title="' . $txt[92] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', '</span>';
if (!empty($member['ip']))
echo '
(<a href="' . $scripturl . '?action=trackip;searchip=' . $member['ip'] . '" target="_blank">' . $member['ip'] . '</a>)';
echo '
</td>
<td nowrap="nowrap">', $member['time'], '</td>
<td>', $member['action'], '</td>';
}
echo '</tr>';
Thank you Sebastian!!! You are a God-send...that was perfect!
hello...
i like this...
but when i used this, each i modified post or post somehing always appeared ""Session verification failed. Please try logging out and back in again, and then try again. ""
so when i removed sign.php, i can modify and post again...
any sollution? i still want to use signature info stats
Can this work with smf 1.1.8?
I tried but dont know where to add code from step 3? :/
When i try to browse signature_info.php it says:
QuoteThe image "http://www.samo-opusteno.info/forum/signature_info.php" cannot be displayed, because it contains errors.
Hi,
Thanks for sharing the lovely signature codes , indeed one..................... :)
Great coding thanks for the help
Hi, i have some custom profiles made by this mod: http://custom.simplemachines.org/mods/index.php?mod=319
How can i add: Avatar, username, and thoose custom fields to my signature ?
What i have to create, sorry, my english is a little bit bad. I want to tell me please the steps again to make that what i asked.
SMF: 2.0.6
Problem: I found some code on page 6 in this topic and I do everything that need and it won't works!!
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else die();
getinfos();
signature();
function getinfos()
{
global $smcFunc, $context, $memberContext;
$mommy = '';
if ($_GET['u'] >= 1)
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : die();
else die();
$result = $smcFunc['db_query']('', '
SELECT member_name
FROM {db_prefix}members
WHERE id_member = '. (int) $id_mem.' AND is_activated = 1
LIMIT 1
',
array()
);
if ($smcFunc['db_fetch_row']($result) > 0)
{
$mprofile[] = (int) $id_mem;
loadMemberData($mprofile, false, 'profile');
foreach ($mprofile as $profile)
{
loadMemberContext($profile);
}
$context['item_comms'] = array();
$context['item_comms'][] = array(
'lbuser' => $memberContext[$id_mem]
);
foreach ($context['item_comms'] as $item_comm)
{
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
}
} else die();
if (!empty($context['avatar']))
{
$mommy = !empty($context['avatar']) ? $context['avatar'] : '';
$mommy = preg_split('/;/',$mommy, -1, PREG_SPLIT_OFFSET_CAPTURE);
$mommy = $mommy [1][0];
$mommy = trim(substr(strrchr($mommy, '='), 1));
$result2 = $smcFunc['db_query']('','
SELECT filename
FROM {db_prefix}attachments
WHERE id_attach = ' . (int) $mommy . ' AND attachment_type = 0 AND approved = 1
LIMIT 1',
array()
);
list($count_result) = $smcFunc['db_fetch_row']($result2);
$context['filename_avatar'] = $count_result;
$smcFunc['db_free_result']($result2);
}
$smcFunc['db_free_result']($result);
}
function signature()
{
global $context, $settings, $modSettings;
$lemo = '';
$img_url = $settings['default_theme_url'];
$membername = $context['membername'];
$posts = $context['posts'];
if (!empty($context['filename_avatar']))
{
$lemo = $context['filename_avatar'];
}
else {
$lemo = '';
}
$avatar = $context['avatar'];
$gender = $context['gender'];
if (preg_match( '/Male/', $gender))
{
$gender = "male";
$img_gender = "$img_url/images/Male.gif";
}
elseif (preg_match( '/Female/', $gender)) {
$gender = "female";
$img_gender = "$img_url/images/Female.gif"; }
else {$gender = "n/a"; $img_gender = "$img_url/images/star.gif";}
$karmaBad = $context['karmaBad'];
$karmaGood = $context['karmaGood'];
if ($modSettings['karmaMode'] == '1')
{
$karma = $karmaGood - $karmaBad;
} elseif ($modSettings['karmaMode'] == '2')
{
$karma = '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif ($modSettings['karmaMode'] == '0')
{
$karma = 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++
$backimg = "$img_url/images/sign.png"; // or where you want
$noavatar = "$img_url/images/noavatar.png"; // or where you want
$set_avatar_height = 0; //move avatar up/down
$set_avatar_width = 0; //move avatar left/right
$set_gender_style = 0; // 0 text , 1 image
$set_gender_height = -92; //move gender up/down
$set_gender_width = -230; //move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++
if (!empty($avatar)) {$avatar = $avatar;}
else {$avatar = $noavatar;}
if (!empty($lemo)) { $ext = substr(strrchr($lemo, '.'), 1); }
else {$ext = substr(strrchr($avatar, '.'), 1);}
unset($lemo);
if ($ext == 'png') {$img_bgr = imagecreatefrompng($avatar); }
elseif ($ext == 'jpg') {$img_bgr = imagecreatefromjpeg($avatar); }
elseif ($ext == 'gif') {$img_bgr = imagecreatefromgif($avatar); }
else die();
$size = getimagesize($backimg);
if ($set_gender_style == 1) {
$img_bgr_gender = imagecreatefromgif($img_gender);
$image_width_gender = imagesx($img_bgr_gender);
$image_height_gender = imagesy($img_bgr_gender);
$dest_x_gender = $size[0] - $image_width_gender + $set_gender_width;
$dest_y_gender = $size[1] - $image_height_gender + $set_gender_height;
}
$image_width = imagesx($img_bgr);
$image_height = imagesy($img_bgr);
//______________avatar width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
{
$set_avatar_width = $set_avatar_width + (($image_width - 101) * 0.35);
$set_avatar_height = $set_avatar_height + (($image_height - 101) * 0.35);
}
else { die();}
$image = imagecreatetruecolor($image_width, $image_height);
$image = imagecreatefrompng($backimg);
$dest_x = $size[0] - $image_width + $set_avatar_width;
$dest_y = $size[1] - $image_height + $set_avatar_height;
imagecopymerge($image, $img_bgr, $dest_x, $dest_y, 0, 0, $image_width, $image_height, 100);
if ($set_gender_style == 1) {
imagecopymerge($image, $img_bgr_gender, $dest_x_gender, $dest_y_gender, 0, 0, $image_width_gender, $image_height_gender, 100);
}
$green = ImageColorAllocate ($image, 23, 124, 17);
$blue = ImageColorAllocate ($image, 0, 0, 255);
$red = ImageColorAllocate ($image, 255, 0, 0);
$white = ImageColorAllocate ($image, 255, 255, 255);
$black = ImageColorAllocate ($image, 0, 0, 0);
ImageString($image, 4, 20, 35, "Postova: $posts", $black);
ImageString($image, 4, 20, 51, "Karma: $karma", $black);
if ($set_gender_style == 0) {
ImageString($image, 5, 31, 4, "$membername", $black);
ImageString($image, 4, 20, 66, "Pol: $gender", $black);
} else {ImageString($image, 5, 44, 4, "$membername", $black);}
header("Content-Type: image/png");
$php = PHP_VERSION;
if (@version_compare(PHP_VERSION, '5.1.0', ">="))
{
// if PHP v5.1 ++
Imagepng($image,null,9,null);
}
else {
Imagepng($image,null,90,null);
}
ImageDestroy ($image);
ImageDestroy ($img_bgr);
}
?>
I have uploaded file sign.php in public_html where is my forum (up code)
I made some photos in photoshop
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fgti-roleplay.net%2FThemes%2Fdefault%2Fimages%2Fnoavatar.png&hash=991cacdaa1b48212214bb60ffd3f605959ebbf29) I'm uploaded this to Themes/default/images I named this as noavatar.png
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fgti-roleplay.net%2FThemes%2Fdefault%2Fimages%2Fsign.png&hash=c27745236a6e205ddb4a2cdd664fde7d05073df9) and this I'm uploaded to Themes/default/images I named this as sign.png
When I put this in signature area shows this (https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.gti-roleplay.net%2Fsign.php%3Fu%3D1&hash=55c3ac6f5e2b1ebfeeb42b21aa5efbbc3d56dd3f)
I used this code
[img]http://www.gti-roleplay.net/sign.php?u=1[/img]
Sorry for bad English!
I still use this quite successully for a few forums, and even adapted it to display some of my user stats on a bitcoin mining site.
However, why I am here today, even though support is stated as no longer offered is just to see if anyone can tell me how to make, if possible, one of the text strings underlined... Ty.
imageline() will be your friend. You will have to draw the underline in yourself since imagestring() has no function for it.
Quote from: Sir Cumber-Patcher on January 28, 2014, 06:48:14 PM
imageline() will be your friend. You will have to draw the underline in yourself since imagestring() has no function for it.
I hate to ask because support on this is no longer offered and all I originally asked for was an idea but I looked at the imageline() php manual and got a little lose, could you maybe please help me with this one small thing ?
REMOVED
This is the line I want underlined using the same color variable.
ImageString($im, 3, 47, 40, "BTC-Guild User: MoreBloodWine", $lightblue);
Um, what exactly is the problem? You already have your image ($im), you already know the top left corner of the text you're working on (since you're supplying it with the imagestring calls), you already have your colour.
You're just feeding it the x,y co-ordinates of where the line is supposed to start and where it's supposed to end. You already have the x starting co-ordinate (same as the text's x co-ordinate), you'll need to add a few pixels to y to get its y position (since you already have the TOP of the text, you need to add some for the height, plus probably 2 pixels to give it space, whatever looks right)
Then for the end of the line, y will be the same (since it's horizontal) and x will be the start plus the number of letters * the width of the font in use. imagefontwidth(3) and imagefontheight(3) will tell you the size of all the letters in font 3 which is what you're using. You should be able to figure this out if you just take a minute to think about it.
Just need to find a more appropriate background image but check it out ;-)
Image found !
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.eojmarket.com%2FBTC-Guild_Stat_Sig%2Fbtcg_stat_sig-MoreBloodWine.php&hash=484b8586517eb5d76b392dbc4aaf5b91f17d1055)
All varibles updated from a file thats auto written by a cron job from an API !
Edit: Do you know if there's a way to auto length the line to cover the length of the text line if that makes sense ?
Basically if I render this for other users thee underline will eeither be too long or not long enough based on the length of their displayed name compared to mine.
ImageString($im, 3, 100, 37, "BTC-Guild User: $user_name", $lightblue);
ImageLine($im, 100, 50, 302, 50, $lightblue);
This is why I sort of hinted at "Then for the end of the line, y will be the same (since it's horizontal) and x will be the start plus the number of letters * the width of the font in use"
As in you know the line you're writing, you know the number of letters in it (strlen is your friend), you know the size of the font (imagefontwidth is your friend)... I'm pretty sure by now that you know how to multiply two numbers together and add another...
Quote from: Sir Cumber-Patcher on January 28, 2014, 11:06:02 PM
This is why I sort of hinted at "Then for the end of the line, y will be the same (since it's horizontal) and x will be the start plus the number of letters * the width of the font in use"
As in you know the line you're writing, you know the number of letters in it (strlen is your friend), you know the size of the font (imagefontwidth is your friend)... I'm pretty sure by now that you know how to multiply two numbers together and add another...
Ya 1 x 2 + 4 = 6
Just not sure on the new code.Edit: Got some of it worked out...
Just need to work on the imagefontwidth thing now... hope I can pick it up the way I have the rest lol.
$str = "BTC-Guild User: " . $user_name;
$length = strlen($str);
ImageString($im, 3, 100, 37, "$str - $length", $lightblue);
ImageLine($im, 100, 50, 302, 50, $lightblue);
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.eojmarket.com%2FBTC-Guild_Stat_Sig%2Feleuthria%2Fbtcg_stat_sig-eleuthria.php&hash=5815ca7221452884e0d830150c39bb4e9907bcaa)
Well, if the line starts at 100... it's going to end at 100 + ($length * imagefontwidth(3)), right?
A string take away a number doesn't mean anything...
Thx... was hopin to get it on my own but thx ;-)