News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

signature info stats [no more updates and support]

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

Previous topic - Next topic

sebastian

#140
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

find
ImageString($image, 5, 31, 4, "$membername", $black);
replace
imagettftext($image, 12, 0, 31, 17, $black, $font, "$membername");



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.

sebastian

#141
signature arcade last games thumbs




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);

}
 
?>

brianjw

Thanks so much! I am not able to test it yet though! I will let you know if it works when I do :)

Sun11

Can someone make a Mod, meaning i can automatically install it on SMF from Packages for SMF 1.1.4 PLEASE

Fiery

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?

sebastian

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.

Nibogo

when i go to:

http://mundo-se.com/foro/sign.php?u=1

appear:

QuoteWarning:  imagecreatefrompng() [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]: 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]: 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]: 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

Panzer-


sebastian

#148
@ 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';



matasanos

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"

sebastian

Hello matasanos,

Can you give us your GD library info?

make a php file like this gdinfo.php
<?php
var_dump
(gd_info());
?>

Nibogo

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


sebastian

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.

Ginza

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 [nofollow]

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 [nofollow]?

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.

brianjw

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. :)

Ginza

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]  ??

brianjw

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.

Ginza

brianjw... thank you so much.. i will give it a shot and i will come back if i have any issue.

Nibogo

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

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.


Thanks for your help but didnt work i do the two modifications  :'( :'( :'(

This mod is not for me  :( :(

MoreBloodWine

#159
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 ;-)



Code emoved...
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Advertisement: