4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: eslack on September 14, 2007, 05:56:16 AM

Title: Multi upload for 1 ID
Post by: eslack on September 14, 2007, 05:56:16 AM
how can i do this?:

i want the users be able to upload multiple files so then show that files on details.php

thnx!
Title: Re: Multi upload for 1 ID
Post by: thunderstrike on September 14, 2007, 12:52:08 PM
1 - Please read this:

http://www.4homepages.de/forum/index.php?topic=8802.0

Quote
i want the users be able to upload multiple files so then show that files on details.php

2 - http://www.4homepages.de/forum/index.php?topic=8517.0 for multiupload MOD request.
Title: Re: Multi upload for 1 ID
Post by: Nicky on September 14, 2007, 02:03:12 PM
@thunderstrike

that's wrong mod for request.

he want to add more pics for 1 IMAGE_ID

with "multiupload MOD" you will get 10 pics with 10 image_id's

@eslack,
i think not there is rightnow mod for that what you want. BUT maybe thunderstrike will have time to make one :)
Title: Re: Multi upload for 1 ID
Post by: thunderstrike on September 14, 2007, 10:16:09 PM
Quote
he want to add more pics for 1 IMAGE_ID

I do with one of MOD. No point really ... more SQL ressource use for use many IDs of row ...
Title: Re: Multi upload for 1 ID
Post by: Nicky on September 14, 2007, 11:41:21 PM
thunder,
no idea what you talking about. try to write a little bit clearer.

table images:

row1 : image_id, cat_id, image_name, image_media_file_1, image_media_file_2, image_media_file_3, image_thumb_file_1, image_thumb_file_2, image_thumb_file_3 and so on..
Title: Re: Multi upload for 1 ID
Post by: thunderstrike on September 14, 2007, 11:47:16 PM
Quote
no idea what you talking about. try to write a little bit clearer.

I write clearer and clear I can write !

Quote
image_id

1 same image ID with 10 rows ? Think of 1000 images like that ...
Title: Re: Multi upload for 1 ID
Post by: Nicky on September 14, 2007, 11:56:30 PM
on a good server that should not be a problem..
maybe he have one..

Quote
Our database contains: 2437 models in 22 categories.

site working fine for me
Title: Re: Multi upload for 1 ID
Post by: mawenzi on September 15, 2007, 12:42:55 AM
... without any copyright ... :!:
... and no 4images Copyright-Removal-Licence ... :!:
Title: Re: Multi upload for 1 ID
Post by: eslack on September 15, 2007, 02:45:02 AM
thanks,i already saw that mod, thunderstrike, but it is not what I am looking for..

i can add more images and raise them to the data folder

but i have no idea how to display that in details.php

maybe creating folders for each user?

how can i do that?

i ve tried to edit

define('MEDIA_DIR', '../data/media/');

to

define('MEDIA_DIR', '../data/media/$user_id');

but it doesnt work...


thank you!
Title: Re: Multi upload for 1 ID
Post by: thunderstrike on September 15, 2007, 05:17:16 AM
What exacly you try do ? ... Look like some peace miss ... you say $user_id ... so something no say here ...
Title: Re: Multi upload for 1 ID
Post by: eslack on September 15, 2007, 09:16:36 PM
when a member uploads a new image a want the script to create a folder with that member id, and put the images there..

i tryed to change includes/constants.php with define('MEDIA_DIR', '../data/media/$user_id');

but i have no luck..

how can i do that?

for exmple, user eslack has ID 5, then, when he wants to upload a new image, i want the script to make a new folder with his user_id

something like /data/media/5/new_image.jpg

Title: Re: Multi upload for 1 ID
Post by: thunderstrike on September 15, 2007, 09:28:48 PM
Hum ... quick but if:

Quote
define('MEDIA_DIR', '../data/media/$user_id');

for:

Code: [Select]
define('MEDIA_DIR', 'data/media/' . $user_info['user_id']);

but if do so, you need edit ALL PHP files use MEDIA_DIR ... I say use new define:

Code: [Select]
define('MEDIA_USER_DIR', 'data/media/' . $user_info['user_id']);

;)
Title: Re: Multi upload for 1 ID
Post by: eslack on September 15, 2007, 09:50:24 PM
mm, thath doesnt work, i tryed to put that in
constants.php with no luck
and in
upload.php

changing

Code: [Select]
$this->upload_path['media'] = MEDIA_PATH."/".$cat_id;
to

Code: [Select]
$this->upload_path['media'] = MEDIA_PATH."/". $user_info['user_id'];
with no better luck  :(
Title: Re: Multi upload for 1 ID
Post by: thunderstrike on September 15, 2007, 10:07:26 PM
You no say $this, you say define. You change foreach post !!!
$user_info need global in class for work. If no global, $user_info is no see by 4images.
Title: Re: Multi upload for 1 ID
Post by: eslack on September 15, 2007, 10:22:11 PM
thunderstrike, constants.php and upload.php are different files, you know...

i tryed in both...

constants.php is define('MEDIA_DIR', './data/media/');

i change that with no luck and changed that back to define('MEDIA_DIR', '../data/media/');

then i edit upload.php

with no luck too...


i only want to do what i say...
Title: Re: Multi upload for 1 ID
Post by: thunderstrike 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 ? :?
Title: Re: Multi upload for 1 ID
Post by: eslack 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
Title: Re: Multi upload for 1 ID
Post by: thunderstrike 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.
Title: Re: Multi upload for 1 ID
Post by: eslack 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

Title: Re: Multi upload for 1 ID
Post by: thunderstrike 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. ;)
Title: Re: Multi upload for 1 ID
Post by: eslack on September 16, 2007, 11:36:23 PM
thanks man, it works perfect!  :lol:
Title: Re: Multi upload for 1 ID
Post by: eslack 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?
Title: Re: Multi upload for 1 ID
Post by: thunderstrike 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. ;)
Title: Re: Multi upload for 1 ID
Post by: eslack 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?
Title: Re: Multi upload for 1 ID
Post by: thunderstrike 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.
Title: Re: Multi upload for 1 ID
Post by: eslack 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!
Title: Re: Multi upload for 1 ID
Post by: thunderstrike 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 ...
Title: Re: Multi upload for 1 ID
Post by: myr2904 on March 13, 2008, 06:00:47 PM
@thunderstrike - pls help us with this mod

thx a lot