Author Topic: Multi upload for 1 ID  (Read 22335 times)

0 Members and 1 Guest are viewing this topic.

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Multi upload for 1 ID
« Reply #15 on: September 15, 2007, 10:35:38 PM »
Quote
i only want to do what i say...

With post different ... how can I help if post different foreach post ? :?
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 ?

Offline eslack

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Multi upload for 1 ID
« Reply #16 on: September 15, 2007, 10:52:09 PM »
i dont undestand what you r saying, i only want to change $cat_id to $user_id but it doesnt work, its a variable
i dont know how to do that....

$cat_id reads the category ID and puts all images in that folder

$user_id exists, but doest work like i want to

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Multi upload for 1 ID
« Reply #17 on: September 16, 2007, 12:44:18 AM »
Quote
$cat_id reads the category ID and puts all images in that folder

False. $cat_id exist but work for GET or POST from file / action to destination. $cat_cache[$cat_id] is for read category ID. Global from global.php file.

Quote
$user_id exists, but doest work like i want to

False. $user_id exist but work for GET or POST from file / action to destination. $user_info['user_id'] is global from includes/sessions.php file.
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 ?

Offline eslack

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Multi upload for 1 ID
« Reply #18 on: September 16, 2007, 01:11:41 AM »
ok, so, what file i ve to edit to do what i want to do?

member.php?
includes/upload.php?
includes/constants.php?

what i have to change?

if eslack (user id 5) uploads lalala.jpg i want to be uploaded to data/5/lalala.jpg

if thunderstrike (user id 150) uploads lalala.jpg i want to be uploaded to data/150/lalala.jpg


Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Multi upload for 1 ID
« Reply #19 on: September 16, 2007, 02:15:38 AM »
I no test this so make backup.

// Step 1

In includes/upload.php file,

find:

Quote
function upload_file($field_name, $image_type, $cat_id = 0, $file_name = "") {

replace:

Code: [Select]
function upload_file($field_name, $image_type, $cat_id = 0, $user_id = 0, $file_name = "") {

find:

Quote
if ($cat_id) {
      $this->upload_path['thumb'] = THUMB_PATH."/".$cat_id;
      $this->upload_path['media'] = MEDIA_PATH."/".$cat_id;
    }
    else {
      $this->upload_path['thumb'] = THUMB_TEMP_PATH;
      $this->upload_path['media'] = MEDIA_TEMP_PATH;
}

replace:

Code: [Select]
    if ($cat_id) {
      $this->upload_path['thumb'] = THUMB_PATH."/".$cat_id;
      $this->upload_path['media'] = MEDIA_PATH."/".$cat_id;
    } elseif ($user_id) {
      if (!is_dir(ROOT_PATH . "data/" . $user_id) && @is_writable(ROOT_PATH . "data")) {
          @mkdir(ROOT_PATH . "data/" . $user_id, CHMOD_DIRS);
          @mkdir(ROOT_PATH . "data/" . $user_id . "/" . THUMB_PATH, CHMOD_DIRS);
          @mkdir(ROOT_PATH . "data/" . $user_id . "/" . MEDIA_PATH, CHMOD_DIRS);
      }
      $this->upload_path['thumb'] = ROOT_PATH . "data/" . $user_id . "/" . THUMB_PATH;
      $this->upload_path['media'] = ROOT_PATH . "data/" . $user_id . "/" . MEDIA_PATH;
    }
    else {
      $this->upload_path['thumb'] = THUMB_TEMP_PATH;
      $this->upload_path['media'] = MEDIA_TEMP_PATH;
}

// Step 2

In member.php file,

find:

Quote
$upload_cat = ($direct_upload) ? $cat_id : 0;

replace:

Code: [Select]
$upload_cat = ($direct_upload) ? $user_info['user_id'] : 0;

find:

Quote
$new_name = $site_upload->upload_file("media_file", "media", $upload_cat);

replace:

Code: [Select]
$new_name = $site_upload->upload_file("media_file", "media", "", $upload_cat);

find:

Quote
$new_thumb_name = $site_upload->upload_file("thumb_file", "thumb", $upload_cat, get_basefile($new_name));

replace:

Code: [Select]
$new_thumb_name = $site_upload->upload_file("thumb_file", "thumb", "", $upload_cat, get_basefile($new_name));

After upload, you need SELECT image from user. Right now, is IMAGES_TABLE, you need to find way for user. ;)
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 ?

Offline eslack

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Multi upload for 1 ID
« Reply #20 on: September 16, 2007, 11:36:23 PM »
thanks man, it works perfect!  :lol:

Offline eslack

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Multi upload for 1 ID
« Reply #21 on: September 16, 2007, 11:46:24 PM »
and the last one, its posible that details.php show that images?

how can details.php read a whole directory and show the images?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Multi upload for 1 ID
« Reply #22 on: September 17, 2007, 01:21:22 AM »
Quote
how can details.php read a whole directory and show the images?

Is what I say day before ... you find way for do so. ;)
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 ?

Offline eslack

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Multi upload for 1 ID
« Reply #23 on: September 18, 2007, 01:37:13 AM »
i dont know anything about php or mysql  :cry: anybody can help me?
maybe 3d export is using another external script?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Multi upload for 1 ID
« Reply #24 on: September 18, 2007, 03:15:26 AM »
Ok ... a bit more for help but is it ... IMAGES_TABLE is use all over script ... no can help for this large (axcept if contract). Is very large for edit.

So bit more ...

// Step 1

In includes/constants.php file,

add:

Code: [Select]
define('USERS_IMAGES_TABLE', $table_prefix.'users_images_table');
define('USERS_IMAGES_TEMP_TABLE', $table_prefix.'users_images_temp_table');

// Step 2

In member.php file,

find:

Quote
if ($direct_upload) {
 $sql = "INSERT INTO ".IMAGES_TABLE."
                (cat_id, user_id, image_name, image_description, image_keywords, image_date, image_active, image_media_file, image_thumb_file, image_download_url, image_allow_comments".$additional_field_sql.")
                VALUES
                ($cat_id, ".$user_info['user_id'].", '$image_name', '$image_description', '$image_keywords', $current_time, $image_active, '$new_name', '$new_thumb_name', '$image_download_url', $image_allow_comments".$additional_value_sql.")";
        $result = $site_db->query($sql);
        $image_id = $site_db->get_insert_id();
        if ($result) {

add after:

Code: [Select]
$sql = "INSERT INTO ".USERS_IMAGES_TABLE."
                (cat_id, user_id, image_name, image_description, image_keywords, image_date, image_active, image_media_file, image_thumb_file, image_download_url, image_allow_comments".$additional_field_sql.")
                VALUES
                ($cat_id, ".$user_info['user_id'].", '$image_name', '$image_description', '$image_keywords', $current_time, $image_active, '$new_name', '$new_thumb_name', '$image_download_url', $image_allow_comments".$additional_value_sql.")";
        $result1 = $site_db->query($sql);

find:

Quote
}
      else {         
        $sql = "INSERT INTO ".IMAGES_TEMP_TABLE."
                (cat_id, user_id, image_name, image_description, image_keywords, image_date, image_media_file, image_thumb_file, image_download_url".$additional_field_sql.")
                VALUES
                ($cat_id, ".$user_info['user_id'].", '$image_name', '$image_description', '$image_keywords', $current_time, '$new_name', '$new_thumb_name', '$image_download_url'".$additional_value_sql.")";
        $result = $site_db->query($sql);

add after:

Code: [Select]
}
      else {         
        $sql = "INSERT INTO ".USERS_IMAGES_TEMP_TABLE."
                (cat_id, user_id, image_name, image_description, image_keywords, image_date, image_media_file, image_thumb_file, image_download_url".$additional_field_sql.")
                VALUES
                ($cat_id, ".$user_info['user_id'].", '$image_name', '$image_description', '$image_keywords', $current_time, '$new_name', '$new_thumb_name', '$image_download_url'".$additional_value_sql.")";
        $result1 = $site_db->query($sql);

// Step 3

Create new SQL table (same with IMAGES_TABLE and IMAGES_TEMP_TABLE field inside) in phpmyadmin by use your_table_prefix_users_images_table and your_table_prefix_users_images_temp_table (change your_table_prefix with real name).

// Step 4

In details.php file,

Re-select fields with new table (USERS_IMAGES_TABLE) but from data/user ID folder and see if work.

Is all I can do for you for this ... is very large.
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 ?

Offline eslack

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Multi upload for 1 ID
« Reply #25 on: September 18, 2007, 08:00:58 AM »
thanks, but im lost  :oops: it doesnt work like i want...

how much $$ do you want to make all the work? (multi upload for 1 id like in 3d export)

thanks man!

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Multi upload for 1 ID
« Reply #26 on: September 18, 2007, 01:26:04 PM »
thanks, but im lost  :oops: it doesnt work like i want...

Hard to know if no screenshot / post example URL of someone create this ...

Quote
how much $$ do you want to make all the work? (multi upload for 1 id like in 3d export)

thanks man!

If want this for finance, please post in request for paid in forum ...
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 ?

Offline myr2904

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Multi upload for 1 ID
« Reply #27 on: March 13, 2008, 06:00:47 PM »
@thunderstrike - pls help us with this mod

thx a lot