• [MOD] Member personal photo v1.1.3 by V@no (2011-10-23) 4 0 5 1
Currently:  

Author Topic: [MOD] Member personal photo v1.1.3 by V@no (2011-10-23)  (Read 327225 times)

0 Members and 1 Guest are viewing this topic.

Offline crs

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: [MOD] Member personal photo v1.1.1 by V@no
« Reply #255 on: October 04, 2008, 01:38:27 AM »
Hallo

Ich würde das Userbild gerne neben den ganzen Userinformationen anzeigen.
Standard sieht man das Foto ja zwischen den Informationen...

Ist bestimmt leicht zu machen aber ich bin Anfänger :(

Beispielfoto, wie es aussehen soll hänge ich an.




Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Member personal photo v1.1.1 by V@no
« Reply #256 on: October 04, 2008, 01:52:17 AM »
It doesn't look like the default template you are using, so unless you provide a link to your gallery you probably won't get far with such request.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline crs

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: [MOD] Member personal photo v1.1.1 by V@no
« Reply #257 on: October 04, 2008, 02:50:46 AM »
www.Autospotter.de

Look at my profile "crs" i´ve uploaded a picture.
But i want to show the picture beside the userinfos, not inside...
I´ ve uploaded an example of that in my post before.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Member personal photo v1.1.1 by V@no
« Reply #258 on: October 04, 2008, 06:39:15 AM »
try attached template
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline crs

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: [MOD] Member personal photo v1.1.1 by V@no
« Reply #259 on: October 04, 2008, 08:18:32 PM »
Hi, thanks for this, but its still not perfect  :(

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: [MOD] Member personal photo v1.1.1 by V@no
« Reply #260 on: December 05, 2008, 10:39:54 AM »
I want users to upload their personal photo when they register so I added the following to register_form.html:

   <tr>
            <td class="row1" valign="top"><b>{lang_userpic}</b>
            <SPAN class="smalltext">   
                <br />
                <b>{lang_userpic_upload}</b>
               </SPAN>
            </td>
            <td class="row1">
              <INPUT type="file" name="userpic_file"  size="30" class="input" /><br />
              {if userpic_img}<img src="{userpic_img}"><br /><input type="checkbox" name="userpic_del" value="1">&nbsp;{lang_userpic_del}{endif userpic_img}
            </TD>
          </TR>


However, for some reason, the {lang_userpic_upload} text will not appear in the registration form, although it is visible in the edit profile page?  Please help!

hi,
is there already a solution available for integrating user pic upload in register-form?
would be nice if someone could solve this question...
best regards,
bergblume

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.806
  • I ♥ 4I
    • View Profile
Re: [MOD] Member personal photo v1.1.1 by V@no
« Reply #261 on: December 06, 2008, 07:19:15 PM »
   
Hello,

there's something in me that disturbs modification. If I were a picture in the size of "352x460" and upload to the admin area the size of "200x267" set had me on the picture "150x200" asked. How can I get the out that this image then as a "200x267" is cut?

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: [MOD] Member personal photo v1.1.1 by V@no
« Reply #262 on: December 09, 2008, 11:10:05 AM »

hi,
is there already a solution available for integrating user pic upload in register-form?
would be nice if someone could solve this question...
best regards,
bergblume

hello,

can anyone tell me how to insert form for uploading user-pic directly in register-form!?
thank you in advance for your help!

bergblume

Offline alekinna

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Gallery of cross-stitching
Re: [MOD] Member personal photo v1.1.1 by V@no
« Reply #263 on: December 11, 2008, 07:49:34 AM »
If you deleted user from DB, for deleting his userpic find in the file admin/users.php

Code: [Select]
$sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_name")."
          FROM ".USERS_TABLE."
          WHERE ".get_user_table_field("", "user_id")." IN ($user_ids)";
  $user_result = $site_db->query($sql);
  $image_ids_sql = "";
  while ($user_row = $site_db->fetch_array($user_result)) {
    $user_id = $user_row[$user_table_fields['user_id']];
    $user_name = $user_row[$user_table_fields['user_name']];

replace with
Code: [Select]
$sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_name").", userpic
          FROM ".USERS_TABLE."
          WHERE ".get_user_table_field("", "user_id")." IN ($user_ids)";
  $user_result = $site_db->query($sql);
  $image_ids_sql = "";
  while ($user_row = $site_db->fetch_array($user_result)) {
    $user_id = $user_row[$user_table_fields['user_id']];
    $user_name = $user_row[$user_table_fields['user_name']];
    $userpic = $user_row['userpic'];
    if (file_exists(ROOT_PATH."data/userpic/".$userpic)) {
      unlink(ROOT_PATH."data/userpic/".$userpic);
    }

Quote
can anyone tell me how to insert form for uploading user-pic directly in register-form!?

I did in this way:

1. in the template register_form.html before
Code: [Select]
{if captcha_registration}
add
Code: [Select]
          {if userpic_allowed}
          <tr>
            <td width="50%" class="row2" valign="top"><b>{lang_userpic}</b>
              <SPAN class="smalltext">
                <br />
                {lang_userpic_upload}
              </SPAN>
            </td>
            <td class="row2">
              <INPUT type="file" name="userpic_file"  size="30" class="input" />
            </TD>
          </TR>
          {endif userpic_allowed}

1.1 find
Code: [Select]
<form method="POST" action="{url_register}">
replace with
Code: [Select]
<form method="POST" action="{url_register}" enctype="multipart/form-data">

2. in the file register.php

find
Code: [Select]
$captcha = (isset($HTTP_POST_VARS['captcha'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['captcha'])) : "";
add above
Code: [Select]
$userpic = "";
  $userpics_dir = ROOT_PATH."data/userpic/";

2.1 find
Code: [Select]
} // end if
add above
Code: [Select]
    if (!empty($HTTP_POST_FILES['userpic_file']['tmp_name']) && $HTTP_POST_FILES['userpic_file']['tmp_name'] != "none") {
      $userpic = 1;
      $mime_types = array(
        "image/jpeg",
        "image/pjpeg",
        "image/gif",
        "image/x-png"
      );
      $extensions = array(
        "jpg",
        "jpeg",
        "gif",
        "png"
      );
      $userpic_ext = strtolower(substr(strrchr($HTTP_POST_FILES['userpic_file']['name'],"."), 1));
      $userpic_mime = $HTTP_POST_FILES['userpic_file']['type'];
      if (!in_array($userpic_mime, $mime_types) || !in_array($userpic_ext, $extensions)) {
        $error = 1;
        $msg .= (($msg != "") ? "<br />" : "").$lang['invalid_file_type']. " (".$userpic_ext.", ".$HTTP_POST_FILES['userpic_file']['type'].")";
      }
      if ($HTTP_POST_FILES['userpic_file']['size'] > $config['userpic_size'] * 1024) {
        $error = 1;
        $msg .= (($msg != "") ? "<br />" : "").$lang['invalid_file_size'];
      }
    }

2.2 find
Code: [Select]
$additional_field_sql = "";
    $additional_value_sql = "";
    if (!empty($additional_user_fields)) {
      $table_fields = $site_db->get_table_fields(USERS_TABLE);
      foreach ($additional_user_fields as $key => $val) {
        if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
          $additional_field_sql .= ", $key";
          $additional_value_sql .= ", '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
        }
      }
    }
    $activationkey = get_random_key(USERS_TABLE, get_user_table_field("", $user_table_fields['user_activationkey']));
    $user_id = $site_db->get_next_id($user_table_fields['user_id'], USERS_TABLE);

replace with
Code: [Select]
    $activationkey = get_random_key(USERS_TABLE, get_user_table_field("", $user_table_fields['user_activationkey']));
    $user_id = $site_db->get_next_id($user_table_fields['user_id'], USERS_TABLE);
   
    if ($config['userpic'] && $userpic) {
        $userpic_name = $user_id.".".$userpic_ext;
        $userpic_file = $userpics_dir.$userpic_name;

        if (!move_uploaded_file($HTTP_POST_FILES['userpic_file']['tmp_name'], $userpic_file)) {
          $error[] = $lang['file_copy_error'];
        }
        else {
          @chmod($userpic_file, CHMOD_FILES);
          $HTTP_POST_VARS['userpic']  = $userpic_name;
        }

      if (empty($error)) {
        if (!function_exists(init_convert_options)){
          require(ROOT_PATH.'includes/image_utils.php');
        }
        $image_info = getimagesize($userpic_file);
        $convert_options = init_convert_options();
        if (($image_info[0] > $config['userpic_width'] || $image_info[1] > $config['userpic_height'])) {
          if ($convert_options['convert_error'] || (!$convert_options['convert_error'] && !resize_image($userpic_file, 85, $config['userpic_width'], 1))) {
            if ($image_info[0] > $config['userpic_width']) {
              $error[] = $lang['invalid_image_width'];
            }
            if ($image_info[1] > $config['userpic_height']) {
              $error[] = $lang['invalid_image_height'];
            }
          }
        }
      }
      if (!empty($error)) {
        $msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".$HTTP_POST_FILES['userpic_file']['name']."</b><br />";
        foreach ($error as $val) {
          $msg .= "<b>".$HTTP_POST_FILES['userpic_file']['name'].":</b> ".$val."<br />";
        }
      }
    }
     
    $additional_field_sql = "";
    $additional_value_sql = "";
    if (!empty($additional_user_fields)) {
      $table_fields = $site_db->get_table_fields(USERS_TABLE);
      foreach ($additional_user_fields as $key => $val) {
        if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
          $additional_field_sql .= ", $key";
          $additional_value_sql .= ", '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
        }
      }
    }

2.3 find
Code: [Select]
"user_invisible_no" => $user_invisible_no,
add below
Code: [Select]
//User Pic
      "userpic_allowed" => $config['userpic'],
      "userpic_max_width" => $config['userpic_width'],
      "userpic_max_height" => $config['userpic_height'],
      "userpic_max_size" => $config['userpic_size']."&nbsp;".$lang['kb'],
      "lang_userpic_upload" => preg_replace("/".$site_template->start."userpic_max_size".$site_template->end."/siU", $config['userpic_size']."&nbsp;".$lang['kb'], preg_replace("/".$site_template->start."userpic_max_width".$site_template->end."/siU", $config['userpic_width'], preg_replace("/".$site_template->start."userpic_max_height".$site_template->end."/siU", $config['userpic_height'], $lang['userpic_upload']))),
//End User Pic
« Last Edit: December 11, 2008, 09:09:10 PM by alekinna »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Member personal photo v1.1.2 by V@no (2008-12-11)
« Reply #264 on: December 11, 2008, 08:33:08 AM »
Thanks alekinna. Added step 14
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: [MOD] Member personal photo v1.1.2 by V@no (2008-12-11)
« Reply #265 on: December 11, 2008, 10:00:27 AM »
thank you so much, alekinna!!!

perfect additional codes to this great MOD !!!  :thumbup: :thumbup: :thumbup:

Offline shadowhunter

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Fotogalerie & Fotocommunity scluzern.com
Re: [MOD] Member personal photo v1.1.2 by V@no (2008-12-11)
« Reply #266 on: December 11, 2008, 01:44:50 PM »
@alekinna:

Your extension with "insert form for uploading user-pic directly in register-form" doesn't works! It's strange.
I made all the steps for the code change.

- When I upload a file, which isn't allowed, then it doesn't come an error!
- The allowed files aren't uploaded!

Can you help me, please? Thanks!
Greetings

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: [MOD] Member personal photo v1.1.2 by V@no (2008-12-11)
« Reply #267 on: December 11, 2008, 01:54:21 PM »
hi scluzern,
you are right - I also just tried it out - uploaded user_pic is not shown after registering...
@ alekinna, can you pls. help! I used further the small modification of V@no described here, in order to show a noimge.png-pic for the case a user has not uploaded a user-pic.

oh, crap! you are right, I didnt think about that...:oops:
well, ok, first, restore the database with this query:
Code: [Select]
UPDATE 4images_users SET userpic = '' WHERE userpic = 'noimage.png';
ALTER TABLE 4images_users CHANGE userpic userpic VARCHAR( 255 ) DEFAULT '' NOT NULL

Then in member.php find:
Code: [Select]
      "userpic_img" => ($config['userpic'] && $user_row['userpic']) ? ROOT_PATH."data/userpic/".$user_row['userpic'] : "", Replace it with:
Code: [Select]
      "userpic_img" => ($config['userpic'] && $user_row['userpic']) ? ROOT_PATH."data/userpic/".$user_row['userpic'] : ROOT_PATH."data/userpic/noimage.png",
Then find:
Code: [Select]
    "userpic_img" => ($user_info['userpic']) ? ROOT_PATH."data/userpic/".$user_info['userpic'] : "",Replace it with:
Code: [Select]
    "userpic_img" => ($user_info['userpic']) ? ROOT_PATH."data/userpic/".$user_info['userpic'] : ROOT_PATH."data/userpic/noimage.png",Place your noimage.png image into data/userpic/ folder.

find attached noimage.png

greetings, bergblume

Offline shadowhunter

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Fotogalerie & Fotocommunity scluzern.com
Re: [MOD] Member personal photo v1.1.2 by V@no (2008-12-11)
« Reply #268 on: December 11, 2008, 02:08:58 PM »
Problem solved
Quote
If you deleted user from DB, for deleting his userpic find in the file admin/users.php
I have found an another error:
If I have deleted a user without an image, then the following error in ACP comes:
Code: [Select]
Warning: unlink(./../data/userpic/) [function.unlink]: Is a directory in /home/www/................../admin/users.php on line 60
User erfolgreich gelöscht asd (ID: XXX)
  Bilder erfolgreich gelöscht
  Kommentare erfolgreich gelöscht

If I have deleted a user with an image, then it works perfectly!
Greetings

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Member personal photo v1.1.2 by V@no (2008-12-11)
« Reply #269 on: December 11, 2008, 03:27:36 PM »
Ops, my bad.
Please re-do Step 14. Should fix the error.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)