• [Mod] Avatar v2.01 5 0 5 1
Currently:  

Author Topic: [Mod] Avatar v2.01  (Read 478317 times)

0 Members and 1 Guest are viewing this topic.

Offline scorpi1

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: [Mod] Avatar v2.01
« Reply #345 on: December 17, 2007, 10:31:51 PM »

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Avatar v2.01
« Reply #346 on: December 18, 2007, 07:21:11 PM »
install_avatar.zip attached to the 1st post
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline Daniel

  • Full Member
  • ***
  • Posts: 183
  • php rockt
    • View Profile
Re: [Mod] Avatar v2.01
« Reply #347 on: December 18, 2007, 07:52:13 PM »
Dieses

onkeypress="if(window.event.keyCode==13){ this.form.submit(); }" onchange="document.images.icons.src='{template_url}/avatars/'+document.creator.user_avatar.options[document.creator.user_avatar.selectedIndex].value;

Was soll den das machen?
Soll das das jeweils angeklickte Bild zeigen?
4images in Benutzung/use seit/since 2002 / Version 1.7.6

skiemor

  • Guest
Re: [Mod] Avatar v2.01
« Reply #348 on: December 26, 2007, 02:05:24 AM »
Thanks you for the great MOD V@no! It works perfect! :thumbup:
Is there a way to get the avatar in DreamBoard too?

Chris.
« Last Edit: December 26, 2007, 10:33:07 AM by skiemor »

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [Mod] Avatar v2.01
« Reply #349 on: December 26, 2007, 05:08:59 PM »
Thanks you for the great MOD V@no! It works perfect! :thumbup:
Is there a way to get the avatar in DreamBoard too?

Chris.

There is problem for add avatar in dreamboard for topic creator. Is no show right.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

skiemor

  • Guest
Re: [Mod] Avatar v2.01
« Reply #350 on: December 26, 2007, 05:38:15 PM »
Ok, thank you, thunderstrike, for anwer. It's not really important, to see an avatar in board.
In gallery it works and that is good and enough. ;-)

Chris.

Offline sanko86

  • Sr. Member
  • ****
  • Posts: 310
    • View Profile
    • Elemegim
Re: [Mod] Avatar v2.01
« Reply #351 on: April 14, 2008, 03:37:49 PM »
copy and paste

kopyalarken hatalı kopyalama yapmışsın" syntax error" bu demek.

Code: [Select]
  case "avatar":
    show_avatar_row($val[0], $field_name, $value);
    break;
      case "text":
      default:
        show_input_row($val[0], $field_name, $value);
   
      } // end switch
    }
  }
}
//-----------------------
//------ Avatar ---------
//-----------------------
function show_avatar_row($title, $name, $value = "blank.gif"){
  global $config;
  if ($config['avatar_use']){
  $dir = opendir(TEMPLATE_PATH."/avatars/");
  $contents = array();
  while ($contents[] = readdir($dir)){;}
  closedir($dir);
  natcasesort ($contents);
  echo "<tr width=\"50%\"class=\"".get_row_bg()."\" valign='top'>\n<td><p class=\"rowtitle\">".$title."</p></td>\n";
  echo "<td width=\"50%\" height=\"115\" valign=\"middle\">\n<table>\n<tr>\n<td>\n<SELECT name=\"$name\" size=\"6\" onkeypress=\"if(window.event.keyCode==13){this.form.submit();}\" onChange=\"document.form.icons_$name.src='".TEMPLATE_PATH."/avatars/'+document.form.$name.options[document.form.$name.selectedIndex].value;\">";
   if ($value == "blank.gif" || $value == "") {
   $checked = " selected";
   }else{
   $checked = "";
   }
   echo "<option value=\"blank.gif\"$checked>none</option>\n";
  foreach ($contents as $line){
     $filename = substr($line,0,(strlen($line)-strlen(strrchr($line,"."))));
     $extension = substr(strrchr($line,"."), 1);
     $checked = "";
     if ($line == $value) { $checked = " selected"; }
     if (strcasecmp($extension,"gif")==0 || strcasecmp($extension,"jpg")==0 || strcasecmp($extension,"jpeg")==0 || strcasecmp($extension,"png")==0 ){
      if ($line != "blank.gif") {
      $filename = str_replace("_", " ", $filename);
      echo "<option value=\"$line\"$checked>$filename</option>\n";
      }
     }
  }
  echo "</select>\n</td>\n<td valign='middle' align='left'>\n<img align='center' src=\"".TEMPLATE_PATH."/avatars/".(($value == "") ? "blank.gif" : $value)."\" name=\"icons_$name\" border=\"0\" alt=\"\">\n</td>\n</tr>\n</table>\n</td>\n";
  }
}
//----- End Avatar -----
?>
« Last Edit: April 14, 2008, 05:32:21 PM by Nicky »
Web site:http://www.anlatiyoruz.com
Hayat zorluklarla doludur.Ama en zoru insanýn insana düþmanlýðýdýr.

Offline robertx

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: [Mod] Avatar v2.01
« Reply #352 on: April 16, 2008, 10:54:07 AM »
Hello for version 1.7.6 doesn t work :(

i have this error

Parse error: syntax error, unexpected $end in /home/robertx/public_html/photos/member.php on line 1389

I look and this is end of file :

"
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "content" => $content,
  "msg" => $msg,
  "clickstream" => $clickstream,
  "lang_control_panel" => $lang['control_panel']
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>        <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< this is 1389 line
"

thanks

Offline qBass17

  • Addicted member
  • ******
  • Posts: 1.798
  • I ♥ 4I
    • View Profile
Re: [Mod] Avatar v2.01
« Reply #353 on: June 17, 2008, 02:51:54 PM »
Die Mod läuft zu 100% in der aktuellen Version 1.7.6 !!!!!!
Habe diese gerade in meiner priv. Gallery eingebaut und ich habe schon sämtliche Mods installiert!

Man muss nur GANZ genau darauf achten wo es eingebunden werden soll, bzw. wo welcher Code hin soll! Ich habe selber keine Ahnung von PHP daher kann ich nur sagen, dass wenn man ganz genau schaut, dass es auch klappt und es hat beim ersten mal geklappt.

Was aber in der Anleitung fehlt ist, dass in dem Ordner "templates/< your template>/avatars" ein Ordner namens "users" noch rein muss, sonnst sagt er das es fehler in der member.php gibt!

So läuft die Mod 100%!

Was mich interessieren würde ist, dass ich dies ja nicht als Avatar nutzen möchte, sondern das die user dort ihr Foto hochladen können, davon abgesehen, ist das möglich das dies auch wären des Upload verkleinert wird?

Edit:
ist es auch möglich, dass wenn das avatar aus der liste ausgewählt hat, dass es direkt angezeigt wird? So das der user sich eines auch aussuchen kann, ohne das er erst auf absenden klicken muss um es erst zu sehen? Denn das nervt ja wenn ich eines aussuchen, es nicht sehen kann, dann auf absenden klicke und dann ist es das falsche!

Der Code der editprofile
Code: [Select]
    {if user_avatar_images}
    <tr>
      <td colspan="2" class="head1"><span class="Stil3">&raquo; {lang_avatar}</span></td>
    </tr>
    <tr>
      <td class="row2" valign="top"> {if user_avatar_file} <b>{lang_avatar_file}</b><br />
        <span class="smalltext"> <b>{lang_avatar_dim}</b> </span><br />
        {endif user_avatar_file}</td>
      <td class="row2"> {if user_avatar_file}
        Upload vom Computer:<br />
        <input type="file" name="avatar_file"  size="30" class="input" />
        <br />
        {endif user_avatar_file}
        <br />Oder wähle eins aus der Liste aus:<br />
        <select name="user_avatar" class="input" size="6" onkeypress="if(window.event.keyCode==13){ this.form.submit(); }" onchange="document.images.icons.src='{template_url}/avatars/'+document.creator.user_avatar.options[document.creator.user_avatar.selectedIndex].value;">
         
         
          {user_avatar_images}
       
       
        </select>
        <table width="100%" height="100" border="0">
          <tr>
            <td align="center"> {user_avatar_current} </td>
          </tr>
        </table></td>
    </tr>
    {endif user_avatar_images}

Geht das nicht mit sonnem reload oderso?
« Last Edit: June 17, 2008, 03:16:44 PM by Phisker B »

Offline qBass17

  • Addicted member
  • ******
  • Posts: 1.798
  • I ♥ 4I
    • View Profile
Re: [Mod] Avatar v2.01
« Reply #354 on: June 17, 2008, 05:30:02 PM »
Ich habe es geschafft das wenn ein User sein Bild (Avatar) Uploaden will, dass dieses dann verkleinert wird.

Der Code ist folgender:
Code: [Select]
// Filename to store image as
$FILENAME="test";

// Width to reszie image to
$RESIZEWIDTH=100;

// Width to reszie image to
$RESIZEHEIGHT=75;

function ResizeImage($im,$maxwidth,$maxheight,$name){
$width = imagesx($im);
$height = imagesy($im);
if(($maxwidth && $width > $maxwidth) || ($maxheight && $height > $maxheight)){
if($maxwidth && $width > $maxwidth){
$widthratio = $maxwidth/$width;
$RESIZEWIDTH=true;
}
if($maxheight && $height > $maxheight){
$heightratio = $maxheight/$height;
$RESIZEHEIGHT=true;
}
if($RESIZEWIDTH && $RESIZEHEIGHT){
if($widthratio < $heightratio){
$ratio = $widthratio;
}else{
$ratio = $heightratio;
}
}elseif($RESIZEWIDTH){
$ratio = $widthratio;
}elseif($RESIZEHEIGHT){
$ratio = $heightratio;
}
$newwidth = $width * $ratio;
$newheight = $height * $ratio;
if(function_exists("imagecopyresampled")){
$newim = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($newim, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
}else{
$newim = imagecreate($newwidth, $newheight);
imagecopyresized($newim, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
}
ImageJpeg ($newim,$name . ".jpg");
ImageDestroy ($newim);
}else{
ImageJpeg ($im,$name . ".jpg");
}
}

if($_FILES['image']['size']){
if($_FILES['image']['type'] == "image/pjpeg" || $_FILES['image']['type'] == "image/jpeg"){
$im = imagecreatefromjpeg($_FILES['image']['tmp_name']);
}elseif($_FILES['image']['type'] == "image/x-png" || $_FILES['image']['type'] == "image/png"){
$im = imagecreatefrompng($_FILES['image']['tmp_name']);
}elseif($_FILES['image']['type'] == "image/gif"){
$im = imagecreatefromgif($_FILES['image']['tmp_name']);
}
if($im){
if(file_exists("data/avatars/$FILENAME.jpg")){
unlink("data/avatars/$FILENAME.jpg");
}
ResizeImage($im,$RESIZEWIDTH,$RESIZEHEIGHT,$FILENAME);
ImageDestroy ($im);
}
}

Ich habs zunächst in der member.php eingebaut!

Öffne: member.php
Suche:
Code: [Select]
$main_template = "member";

define('GET_CACHES', 1);
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/page_header.php');

if ($action == "") {
  $action = "lostpassword";
}

Danach einfügen:
Code: [Select]
// Filename to store image as
$FILENAME="test";

// Width to reszie image to
$RESIZEWIDTH=100;

// Width to reszie image to
$RESIZEHEIGHT=75;

function ResizeImage($im,$maxwidth,$maxheight,$name){
$width = imagesx($im);
$height = imagesy($im);
if(($maxwidth && $width > $maxwidth) || ($maxheight && $height > $maxheight)){
if($maxwidth && $width > $maxwidth){
$widthratio = $maxwidth/$width;
$RESIZEWIDTH=true;
}
if($maxheight && $height > $maxheight){
$heightratio = $maxheight/$height;
$RESIZEHEIGHT=true;
}
if($RESIZEWIDTH && $RESIZEHEIGHT){
if($widthratio < $heightratio){
$ratio = $widthratio;
}else{
$ratio = $heightratio;
}
}elseif($RESIZEWIDTH){
$ratio = $widthratio;
}elseif($RESIZEHEIGHT){
$ratio = $heightratio;
}
$newwidth = $width * $ratio;
$newheight = $height * $ratio;
if(function_exists("imagecopyresampled")){
$newim = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($newim, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
}else{
$newim = imagecreate($newwidth, $newheight);
imagecopyresized($newim, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
}
ImageJpeg ($newim,$name . ".jpg");
ImageDestroy ($newim);
}else{
ImageJpeg ($im,$name . ".jpg");
}
}

if($_FILES['image']['size']){
if($_FILES['image']['type'] == "image/pjpeg" || $_FILES['image']['type'] == "image/jpeg"){
$im = imagecreatefromjpeg($_FILES['image']['tmp_name']);
}elseif($_FILES['image']['type'] == "image/x-png" || $_FILES['image']['type'] == "image/png"){
$im = imagecreatefrompng($_FILES['image']['tmp_name']);
}elseif($_FILES['image']['type'] == "image/gif"){
$im = imagecreatefromgif($_FILES['image']['tmp_name']);
}
if($im){
if(file_exists("data/avatars/$FILENAME.jpg")){
unlink("data/avatars/$FILENAME.jpg");
}
ResizeImage($im,$RESIZEWIDTH,$RESIZEHEIGHT,$FILENAME);
ImageDestroy ($im);
}
}

Öffne: templates/dein template/members_editprofil.html
Suche:
Code: [Select]
              {lang_upload}
              <INPUT type="file" name="avatar_file"  size="30" class="input" />

Ersetze mit:
Code: [Select]
        Upload vom Computer:<br />
        <input type="file" name="image" size="35" class="input"><br /><input type="submit" value="upload" class="button">

Man kann es auch extra zu dem normalen Upload hinzufügen!

Das klappt wunderbar.

Aber nun zu ein paar kleinen dingen die mich stören!

Wie bekomme ich das hin, dass ich in diesem code:
Code: [Select]
// Filename to store image as
$FILENAME="test";

Den Username als Filename nehmen kann? Also ich habe da z.B Test genommen, aber ich möchte sowas in der Art "user_name", also das dieses Bild dann quasi als "Phisker.jpg" erstellt wird. Ich habe keine Ahnung davon, das mit diesem Code war auch nur Zufall das es klappte.

Dann kommt nich eines, ich habe angegeben:
Code: [Select]
if(file_exists("data/avatars/$FILENAME.jpg")){
unlink("data/avatars/$FILENAME.jpg");

Aber das hochgeladene Bild wird nicht im data/avatars erstellt, sondern immer nur im root Verzeichnis!
Bitte um Hilfe!

Gruß
Phisker

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: [Mod] Avatar v2.01
« Reply #355 on: June 17, 2008, 07:21:23 PM »
hallo,

sollte klappen:
Code: [Select]
$FILENAME="test";=>
Code: [Select]
$FILENAME = $user_info['user_name'];

Kurt

Offline qBass17

  • Addicted member
  • ******
  • Posts: 1.798
  • I ♥ 4I
    • View Profile
Re: [Mod] Avatar v2.01
« Reply #356 on: June 19, 2008, 10:53:04 AM »
Hy,

das klappt wirklich gut!

2 andere fragen!

1) Er lädt als nun das bild als Phisker.jpg hoch, aber wenn ich ein zweites hochlade, dann überschreibt er das andere, kann man was dagegen tun?

2) Ist es möglich einen ordner anzugeben? Weil er läd es immer im root hoch, obwohl ich ja angegeben habe unten data/avatars
Code: [Select]
if($im){
if(file_exists("data/avatars/$FILENAME.jpg")){
unlink("data/avatars/$FILENAME.jpg");
}
ResizeImage($im,$RESIZEWIDTH,$RESIZEHEIGHT,$FILENAME);
ImageDestroy ($im);
}
}

Danke, weiterhin!

Offline autofolie

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • AutoFolie
Re: [Mod] Avatar v2.01
« Reply #357 on: June 25, 2008, 10:29:22 PM »
Hello,

I installed this MOD, but only the registered member sees its avatar, we do not see the avatar of the other members in comments is it normal ?

thank you.

Offline qBass17

  • Addicted member
  • ******
  • Posts: 1.798
  • I ♥ 4I
    • View Profile
Re: [Mod] Avatar v2.01
« Reply #358 on: June 26, 2008, 12:33:20 AM »
Hy,

das klappt wirklich gut!

2 andere fragen!

1) Er lädt als nun das bild als Phisker.jpg hoch, aber wenn ich ein zweites hochlade, dann überschreibt er das andere, kann man was dagegen tun?

2) Ist es möglich einen ordner anzugeben? Weil er läd es immer im root hoch, obwohl ich ja angegeben habe unten data/avatars
Code: [Select]
if($im){
if(file_exists("data/avatars/$FILENAME.jpg")){
unlink("data/avatars/$FILENAME.jpg");
}
ResizeImage($im,$RESIZEWIDTH,$RESIZEHEIGHT,$FILENAME);
ImageDestroy ($im);
}
}

Danke, weiterhin!

Diesen Fehler habe ich bis heute nicht beheben können, auch das es in einem Extra Ordner gespeichert wird, klappt einfach nicht!

Offline autofolie

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • AutoFolie
Re: [Mod] Avatar v2.01
« Reply #359 on: June 26, 2008, 11:22:39 AM »
Hello,

I installed this MOD, but only the registered member sees its avatar, we do not see the avatar of the other members in comments is it normal ?

thank you.


it is only the administrator who sees the avatars, not the members, nor the guests. ???