signature info stats [no more updates and support]

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

Previous topic - Next topic

sebastian

#120
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($mprofilefalse'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, -1PREG_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(40$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_y00$image_width$image_height100);
if (
$set_gender_style == 1) {
imagecopymerge($image$img_bgr_gender,  $dest_x_gender$dest_y_gender00$image_width_gender$image_height_gender100);
}
 
$green ImageColorAllocate ($image2312417); 
$blue ImageColorAllocate ($image00255); 
$red ImageColorAllocate ($image25500);
$white ImageColorAllocate ($image255255255);
$black ImageColorAllocate ($image000);

 
ImageString($image42035"Posts: $posts"$black);
ImageString($image42051"Karma: $karma"$black);
ImageString($image2167"Arcade: $arcade1"$black);
ImageString($image2177"Last 4: $arcade2"$black);
ImageString($image2187"Played: $arcade3"$black);
ImageString($image2197"Games : $arcade4"$black);
if (
$set_gender_style == 0) {
ImageString($image5314"$membername"$black);
ImageString($image42066"Gender: $gender"$black);
} else {
ImageString($image5444"$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.php

1. 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();

brianjw

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: EXCEPT resize them to be more like:
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—Ú÷&shy;—êîjµZ&shy;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   ¤&shy;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¾| § &shy;&shy;
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½ë&shy;ßüÄÓ_ûŒõ"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($mprofilefalse'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, -1PREG_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_y00$image_width$image_height100);
if (
$set_gender_style == 1) {
imagecopymerge($image$img_bgr_gender,  $dest_x_gender$dest_y_gender00$image_width_gender$image_height_gender100);
}
 
$green ImageColorAllocate ($image2312417); 
$blue ImageColorAllocate ($image00255); 
$red ImageColorAllocate ($image25500);
$white ImageColorAllocate ($image255255255);
$black ImageColorAllocate ($image000);

 
ImageString($image42035"Posts: $posts"$black);
ImageString($image42051"Karma: $karma"$black);
if (
$set_gender_style == 0) {
ImageString($image5314"$membername"$black);
ImageString($image42066"Genter: $gender"$black);
} else {
ImageString($image5444"$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 {  }
}

?>


Embrace

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

sebastian

#123
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;


@brianjw

Your 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($mprofilefalse'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, -1PREG_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_y00$image_width$image_height100);
if (
$set_gender_style == 1) {
imagecopymerge($image$img_bgr_gender,  $dest_x_gender$dest_y_gender00$image_width_gender$image_height_gender100);
}
 
$green ImageColorAllocate ($image2312417); 
$blue ImageColorAllocate ($image00255); 
$red ImageColorAllocate ($image25500);
$white ImageColorAllocate ($image255255255);
$black ImageColorAllocate ($image000);

ImageString($image42035"Posts: $posts"$black);
ImageString($image42051"Karma: $karma"$black);
if (
$set_gender_style == 0) {
ImageString($image5314"$membername"$black);
ImageString($image42066"Genter: $gender"$black);
} else {
ImageString($image5444"$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();}

}
?>

brianjw

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($mprofilefalse'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, -1PREG_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_y00$image_width$image_height100);
if (
$set_gender_style == 1) {
imagecopymerge($image$img_bgr_gender,  $dest_x_gender$dest_y_gender00$image_width_gender$image_height_gender100);
}
 
$green ImageColorAllocate ($image2312417); 
$blue ImageColorAllocate ($image00255); 
$red ImageColorAllocate ($image25500);
$white ImageColorAllocate ($image255255255);
$black ImageColorAllocate ($image000);

 
ImageString($image42035"Posts: $posts"$black);
ImageString($image42051"Karma: $karma"$black);
if (
$set_gender_style == 0) {
ImageString($image5314"$membername"$black);
ImageString($image42066"Gender: $gender"$black);
} else {
ImageString($image5444"$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 :)


Brianjw

Embrace

the sign_error.php was the only one that worked for me also



Gonna modify alot, add the money and such there also :)

Embrace

#126
WOOOT! got everything working





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

sebastian

#127
@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($mprofilefalse'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, -1PREG_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_y00$image_width$image_height100);
if (
$set_gender_style == 1) {
imagecopymerge($image$img_bgr_gender,  $dest_x_gender$dest_y_gender00$image_width_gender$image_height_gender100);
}
 
$green ImageColorAllocate ($image2312417); 
$blue ImageColorAllocate ($image00255); 
$red ImageColorAllocate ($image25500);
$white ImageColorAllocate ($image255255255);
$black ImageColorAllocate ($image000);

 
ImageString($image42035"Posts: $posts"$black);
ImageString($image42051"Karma: $karma"$black);
if (
$set_gender_style == 0) {
ImageString($image5314"$membername"$black);
ImageString($image42066"Genter: $gender"$black);
} else {
ImageString($image5444"$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);  
}

?>



Embrace

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!

sebastian

#129
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?


sebastian

#130
smf shop money



<?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($mprofilefalse'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, -1PREG_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_y00$image_width$image_height100);
if (
$set_gender_style == 1) {
imagecopymerge($image$img_bgr_gender,  $dest_x_gender$dest_y_gender00$image_width_gender$image_height_gender100);
}
 
$green ImageColorAllocate ($image2312417); 
$blue ImageColorAllocate ($image00255); 
$red ImageColorAllocate ($image25500);
$white ImageColorAllocate ($image255255255);
$black ImageColorAllocate ($image000);

 
ImageString($image42035"Posts: $posts"$black);
ImageString($image42051"Karma: $karma"$black);
if (
$set_gender_style == 0) {
ImageString($image5314"$membername"$black);
ImageString($image42066"Gender: $gender"$black);
ImageString($image42081"Money: $money"$black);
} else {
ImageString($image5444"$membername"$black);
ImageString($image42066"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);  
}

?>

Embrace

#131
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!!!!


sebastian

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



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

Embrace

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?

sebastian

#134
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.

Embrace

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

sebastian

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

Embrace

Ok so I would have to customize that for every member than?

No problem though, sounds like a good admin only thing :P Thanks!

sebastian

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.

brianjw

#139
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... ($$$)


EDIT
What 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?

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 3
I 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($mprofilefalse'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, -1PREG_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_y00$image_width$image_height100);
if (
$set_gender_style == 1) {
imagecopymerge($image$img_bgr_gender,  $dest_x_gender$dest_y_gender00$image_width_gender$image_height_gender100);
}
 
$green ImageColorAllocate ($image2312417); 
$blue ImageColorAllocate ($image00255); 
$red ImageColorAllocate ($image25500);
$white ImageColorAllocate ($image255255255);
$black ImageColorAllocate ($image000);

 
ImageString($image42035"'. $modSettings['sig_posts'] .': $posts"$black);
ImageString($image42051"'. $modSettings['sig_karma'] .': $karma"$black);
if (
$set_gender_style == 0) {
ImageString($image5554"$membername"$grey);
ImageString($image42066"'. $modSettings['sig_gender'] .': $gender"$black);
} else {
ImageString($image5554"$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

Advertisement: