Ok, we know what this is. No need for say description for this right ?
[28-02-2008] - instruction update -//
Upload same file name (for media and thumb) for each loop you select. ex: file1.jpg for media and file1.jpg for thumb. file2.jpg for media and file2.jpg for thumb in no 2 upload window (read instruction for integrate resize on upload - version 1 or 2 or V@no in my first post or second post - ((// Integrate with auto-resize) step)). [28-02-2008] - end instruction update -I full code this myself and now is work purfect. I patch all pass problem in forum with MOD.
No Kai - no demo Kai 
// Package:
- Single value number in ACP for say how number images is upload to gallery (yes, 1 include so no need for remove MOD to go back single upload).
- Multiupload / Single image upload button is change from 1 to 2 in categories page.
- New code for templates and media template folder for view upload images.
- User is possible for select value of file upload (max limit to admin setting: ACP - > Setting).
- If user access page with URL for multiupload form, auto change to 1 upload for this user.
- Each file is say for upload in media template (@Ivan: Is fix).
- Each content is regroup with thumb and media file so is detect right in mySQL.
- Each count file is match with upload form.
-
$action = multiupload - REMOVE (no need).
- Captcha include.
- Convert string to array - ALL (axcept captcha).
- Additional image fields include with counter.
- HTML template:
ALL parse and register for template.
- Single email for notify with
all upload file - same time in email template.
- Possible for integrate other MOD in forum.
- I post screenshot.
This is VERY BIG MOD. Make
FULL BACKUP of gallery (include mySQL) - or test with fresh gallery (4images v1.76).
// Step 1
In member.php file (very big step):
I change
all 'uploadimage' and 'uploadform' and add
'requestuploadform' action to multiupload so you need replace this (test in fresh gallery if like) - to this:
if ($action == "uploadimage") {
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id))) {
show_error_page($lang['no_permission']);
exit;
}
$txt_clickstream = "";
if ($cat_id && isset($cat_cache[$cat_id])) {
$txt_clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
$txt_clickstream .= $lang['user_upload'];
$num_counter = (isset($HTTP_POST_VARS['num_counter'])) ? intval(trim($HTTP_POST_VARS['num_counter'])) : 1;
for ($i = 0; $i < $num_counter; $i++) {
$remote_media_file = format_url(un_htmlspecialchars(trim((string)$HTTP_POST_VARS['remote_media_file' . $i])));
$remote_thumb_file = format_url(un_htmlspecialchars(trim((string)$HTTP_POST_VARS['remote_thumb_file' . $i])));
$image_name = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_name' . $i]));
$image_description = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_description' . $i]));
$image_keywords = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_keywords' . $i]));
$image_keywords = preg_replace("/[\n\r]/is", ",", $image_keywords);
$image_keywords_arr = explode(',', $image_keywords);
array_walk($image_keywords_arr, 'trim_value');
$image_keywords = implode(',', array_unique(array_filter($image_keywords_arr)));
$image_active = (isset($HTTP_POST_VARS['image_active' . $i]) && $HTTP_POST_VARS['image_active' . $i] == 0) ? 0 : 1;
$image_allow_comments = (isset($HTTP_POST_VARS['image_allow_comments' . $i]) && $HTTP_POST_VARS['image_allow_comments' . $i] == 0) ? 0 : 1;
$image_download_url = (isset($HTTP_POST_VARS['image_download_url' . $i])) ? format_url(un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_download_url' . $i]))) : "";
} // End for.
$captcha = (isset($HTTP_POST_VARS['captcha'])) ? un_htmlspecialchars(trim((string)$HTTP_POST_VARS['captcha'])) : "";
$direct_upload = (check_permission("auth_directupload", $cat_id)) ? 1 : 0;
$upload_cat = ($direct_upload) ? $cat_id : 0;
$error = 0;
$uploaderror = 0;
if ($cat_id == 0) {
$error = 1;
$field_error = preg_replace("/".$site_template->start."field_name".$site_template->end."/siU", str_replace(":", "", $lang['category']), $lang['field_required']);
$msg .= (($msg != "") ? "<br />" : "").$field_error;
}
for ($i = 0; $i < $num_counter; $i++) {
if ((empty($HTTP_POST_FILES['media_file' . $i]['tmp_name']) || $HTTP_POST_FILES['media_file' . $i]['tmp_name'] == "none") && (sizeof($remote_media_file) == 0 || !check_remote_media($remote_media_file))) {
$error = 1;
$msg .= (($msg != "") ? "<br />" : "").$lang['image_file_required'];
}
if (sizeof($image_name) == 0) {
$error = 1;
$field_error = preg_replace("/".$site_template->start."field_name".$site_template->end."/siU", str_replace(":", "", $lang['image_name']), $lang['field_required']);
$msg .= (($msg != "") ? "<br />" : "").$field_error;
}
} // End for.
if ($captcha_enable_upload && !captcha_validate($captcha)) {
$msg .= (($msg != "") ? "<br />" : "").$lang['captcha_required'];
$error = 1;
}
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
for ($i = 0; $i < $num_counter; $i++) {
if (isset($HTTP_POST_VARS[$key . $i]) && intval($val[2]) == 1 && sizeof($HTTP_POST_VARS[$key . $i]) == 0) {
$error = 1;
$field_error = preg_replace("/".$site_template->start."field_name".$site_template->end."/siU", str_replace(":", "", $val[0]), $lang['field_required']);
$msg .= (($msg != "") ? "<br />" : "").$field_error;
}
}
}
}
if (!$error) {
// Start Upload
include(ROOT_PATH.'includes/upload.php');
$site_upload = new Upload();
// Upload Media file
for ($i = 0; $i < $num_counter; $i++) {
$remote_media_file = format_url(un_htmlspecialchars(trim((string)$HTTP_POST_VARS['remote_media_file' . $i])));
if (!empty($HTTP_POST_FILES['media_file' . $i]['tmp_name']) && $HTTP_POST_FILES['media_file' . $i]['tmp_name'] != "none") {
$HTTP_POST_FILES['media_file' . $i]['name'] = $site_upload->upload_file("media_file" . $i, "media", $upload_cat);
if (!$HTTP_POST_FILES['media_file' . $i]['name']) {
$msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".$HTTP_POST_FILES['media_file' . $i]['name']."</b><br />".$site_upload->get_upload_errors();
$uploaderror = 1;
}
} else {
$HTTP_POST_FILES['media_file' . $i]['name'] = $remote_media_file;
}
} // End for.
// Uplad thumb file
require(ROOT_PATH.'includes/image_utils.php');
$convert_options = init_convert_options();
$do_create = 0;
for ($i = 0; $i < $num_counter; $i++) {
$remote_thumb_file = format_url(un_htmlspecialchars(trim((string)$HTTP_POST_VARS['remote_thumb_file' . $i])));
if (!empty($HTTP_POST_FILES['thumb_file' . $i]['tmp_name']) && $HTTP_POST_FILES['thumb_file' . $i]['tmp_name'] != "none" && !$uploaderror) {
$HTTP_POST_FILES['thumb_file' . $i]['name'] = $site_upload->upload_file("thumb_file" . $i, "thumb", $upload_cat, get_basefile($HTTP_POST_FILES['media_file' . $i]['name']));
if (get_basefile(stripslashes(trim(!$HTTP_POST_FILES['thumb_file' . $i]['name'])))) {
$msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['thumb_upload_error'].": ".$HTTP_POST_FILES['thumb_file' . $i]['name']."</b><br />".$site_upload->get_upload_errors();
@unlink(MEDIA_TEMP_PATH."/".get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name']))));
$uploaderror = 1;
}
} elseif (check_remote_thumb($remote_thumb_file)) {
$HTTP_POST_FILES['thumb_file' . $i]['name'] = $remote_thumb_file;
} elseif ($config['auto_thumbnail'] == 1 && !empty($HTTP_POST_FILES['media_file' . $i]['tmp_name']) && $HTTP_POST_FILES['media_file' . $i]['tmp_name'] != "none" && !$uploaderror) {
if ($direct_upload) {
$src = MEDIA_PATH."/".$cat_id."/".get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name'])));
$dest = THUMB_PATH."/".$cat_id."/".get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name'])));
} else {
$src = MEDIA_TEMP_PATH."/".get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name'])));
$dest = THUMB_TEMP_PATH."/".get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name'])));
}
if ($image_info = @getimagesize($src)) {
if ($image_info[2] == 1 || $image_info[2] == 2 || $image_info[2] == 3) {
$do_create = 1;
}
}
if ($do_create) {
if (!$convert_options['convert_error']) {
$dimension = (intval($config['auto_thumbnail_dimension'])) ? intval($config['auto_thumbnail_dimension']) : 100;
$resize_type = (intval($config['auto_thumbnail_resize_type'])) ? intval($config['auto_thumbnail_resize_type']) : 1;
$quality = (intval($config['auto_thumbnail_quality']) && intval($config['auto_thumbnail_quality']) <= 100) ? intval($config['auto_thumbnail_quality']) : 100;
if (create_thumbnail($src, $dest, $quality, $dimension, $resize_type)) {
$HTTP_POST_FILES['thumb_file' . $i]['name'] = get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name'])));
}
}
}
}
} // End for.
if (!$uploaderror) {
$current_time = time();
if ($direct_upload) {
include(ROOT_PATH.'includes/search_utils.php');
$search_words = array();
for ($i = 0; $i < $num_counter; $i++) {
$remote_media_file = format_url(un_htmlspecialchars(trim((string)$HTTP_POST_VARS['remote_media_file' . $i])));
$remote_thumb_file = format_url(un_htmlspecialchars(trim((string)$HTTP_POST_VARS['remote_thumb_file' . $i])));
$image_name = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_name' . $i]));
$new_name = (isset($remote_media_file) && !empty($remote_media_file)) ? $remote_media_file : get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name'])));
$new_thumb_name = (isset($remote_thumb_file) && !empty($remote_thumb_file)) ? $remote_thumb_file : get_basefile(stripslashes(trim($HTTP_POST_FILES['thumb_file' . $i]['name'])));
$image_description = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_description' . $i]));
$image_keywords = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_keywords' . $i]));
$image_keywords = preg_replace("/[\n\r]/is", ",", $image_keywords);
$image_keywords_arr = explode(',', $image_keywords);
array_walk($image_keywords_arr, 'trim_value');
$image_keywords = implode(',', array_unique(array_filter($image_keywords_arr)));
$image_active = (isset($HTTP_POST_VARS['image_active' . $i]) && $HTTP_POST_VARS['image_active' . $i] == 0) ? 0 : 1;
$image_allow_comments = (isset($HTTP_POST_VARS['image_allow_comments' . $i]) && $HTTP_POST_VARS['image_allow_comments' . $i] == 0) ? 0 : 1;
$image_download_url = (isset($HTTP_POST_VARS['image_download_url' . $i])) ? format_url(un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_download_url' . $i]))) : "";
$additional_field_sql = "";
$additional_value_sql = "";
if (!empty($additional_image_fields)) {
$table_fields = $site_db->get_table_fields(IMAGES_TABLE);
foreach ($additional_image_fields as $key => $val) {
if (isset($HTTP_POST_VARS[$key . $i]) && isset($table_fields[$key])) {
$additional_field_sql .= ", $key";
$additional_value_sql .= ", '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key . $i]))."'";
}
}
}
$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) {
foreach ($search_match_fields as $image_column => $match_column) {
if (isset($HTTP_POST_VARS[$image_column])) {
$search_words[$image_column] = stripslashes($HTTP_POST_VARS[$image_column]);
}
}
}
add_searchwords($image_id, $search_words);
} // End for.
}
else {
for ($i = 0; $i < $num_counter; $i++) {
$remote_media_file = format_url(un_htmlspecialchars(trim((string)$HTTP_POST_VARS['remote_media_file' . $i])));
$remote_thumb_file = format_url(un_htmlspecialchars(trim((string)$HTTP_POST_VARS['remote_thumb_file' . $i])));
$image_name = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_name' . $i]));
$new_name = (isset($remote_media_file) && !empty($remote_media_file)) ? $remote_media_file : get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name'])));
$new_thumb_name = (isset($remote_thumb_file) && !empty($remote_thumb_file)) ? $remote_thumb_file : get_basefile(stripslashes(trim($HTTP_POST_FILES['thumb_file' . $i]['name'])));
$image_description = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_description' . $i]));
$image_keywords = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_keywords' . $i]));
$image_keywords = preg_replace("/[\n\r]/is", ",", $image_keywords);
$image_keywords_arr = explode(',', $image_keywords);
array_walk($image_keywords_arr, 'trim_value');
$image_keywords = implode(',', array_unique(array_filter($image_keywords_arr)));
$image_active = (isset($HTTP_POST_VARS['image_active' . $i]) && $HTTP_POST_VARS['image_active' . $i] == 0) ? 0 : 1;
$image_allow_comments = (isset($HTTP_POST_VARS['image_allow_comments' . $i]) && $HTTP_POST_VARS['image_allow_comments' . $i] == 0) ? 0 : 1;
$image_download_url = (isset($HTTP_POST_VARS['image_download_url' . $i])) ? format_url(un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_download_url' . $i]))) : "";
$additional_field_sql = "";
$additional_value_sql = "";
if (!empty($additional_image_fields)) {
$table_fields = $site_db->get_table_fields(IMAGES_TEMP_TABLE);
foreach ($additional_image_fields as $key => $val) {
if (isset($HTTP_POST_VARS[$key . $i]) && isset($table_fields[$key])) {
$additional_field_sql .= ", $key";
$additional_value_sql .= ", '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key . $i]))."'";
}
}
}
$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);
}
}
if ($config['upload_notify'] == 1 && !$direct_upload) {
include(ROOT_PATH.'includes/email.php');
$site_email = new Email();
$config['upload_emails'] = str_replace(" ", "", $config['upload_emails']);
$emails = explode(",", $config['upload_emails']);
$validation_url = $script_url."/admin/index.php?goto=".urlencode("validateimages.php?action=validateimages");
$site_email->set_to($config['site_email']);
$site_email->set_subject($lang['new_upload_emailsubject']);
for ($i = 0; $i < $num_counter; $i++) {
$image_name = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_name' . $i]));
$site_email->register_vars(array(
"image_name" => format_text(trim($image_name), 2),
"media_file_name" => get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name']))),
"thumb_file_name" => get_basefile(stripslashes(trim($HTTP_POST_FILES['thumb_file' . $i]['name'])))
));
} // End for.
$site_email->register_vars(array(
"cat_name" => format_text(trim($cat_cache[$cat_id]['cat_name']), 2),
"validation_url" => $validation_url,
"site_name" => format_text(trim($config['site_name']), 2)
));
$site_email->set_body("upload_notify", $config['language_dir_default']);
$site_email->set_bcc($emails);
$site_email->send_email();
}
$bgcounter = 0;
$total_files_uploaded = 0;
for ($i = 0; $i < $num_counter; $i++) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$image_name = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['image_name' . $i]));
$msg .= $lang['image_add_success'].": <b>".format_text(stripslashes($image_name), 2)."</b> (" . get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name']))).")<br />";
$msg .= (!$direct_upload) ? "<br />".$lang['new_upload_validate_desc'] : "";
$file_extension = get_file_extension(get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name']))));
$file = (is_remote($HTTP_POST_FILES['media_file' . $i]['name'])) ? get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name']))) : (($direct_upload) ? MEDIA_PATH."/".$cat_id."/".get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name']))) : MEDIA_TEMP_PATH."/".get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name']))));
$width_height = "";
if (!is_remote($file) && $imageinfo = @getimagesize($file)) {
$width_height = " ".$imageinfo[3];
}
$media_icon = "<img src=\"".ICON_PATH."/".$file_extension.".gif\" border=\"0\" alt=\"\" />";
$site_template->register_vars(array(
"media_src" => $file,
"media_icon" => $media_icon,
"image_name" => format_text(stripslashes($image_name)),
"width_height" => $width_height
));
$media = $site_template->parse_template("media/".$file_extension);
$site_template->register_vars(array(
"lang_multiupload_media_file_name" => preg_replace("/" . $site_template->start . "media_file_name" . $site_template->end . "/siU", get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name']))), $lang['multiupload_media_file_name']),
"media" => $media,
"counter" => $row_bg_number
));
$content .= $site_template->parse_template("member_multiupload_media");
$total_files_uploaded++;
} // End for.
}
else {
$action = "uploadform";
$sendprocess = 1;
}
}
else {
$action = "uploadform";
$sendprocess = 1;
}
}
if ($action == "requestuploadform") {
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id))) {
show_error_page($lang['no_permission']);
exit;
}
$txt_clickstream = get_category_path($cat_id, 1).$config['category_separator'] . $lang['multiupload_select_title'];
if (isset($config['multiupload_size'])) {
if ($config['multiupload_size'] > 1) {
$request_uploadform_content = "";
for ($i = $config['multiupload_size']; $i > 0; $i--) {
$site_template->register_vars("i", $i);
$request_uploadform_content .= $site_template->parse_template("member_multiuploadform_select_content");
}
$site_template->register_vars(array(
"lang_member_multiuploadform_select" => $lang['member_multiuploadform_select'],
"lang_multiupload_select_title" => $lang['multiupload_select_title'],
"member_multiuploadform_select_content" => $request_uploadform_content,
"cat_id" => $cat_id,
"request_uploadform_value" => $cat_id
));
$content .= $site_template->parse_template("member_multiuploadform_select");
}
}
}
if ($action == "uploadform") {
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id))) {
show_error_page($lang['no_permission']);
exit;
}
$txt_clickstream = "";
if ($cat_id && isset($cat_cache[$cat_id])) {
$txt_clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
$txt_clickstream .= $lang['user_upload'];
if (isset($HTTP_POST_VARS['request_uploadform_value'])) {
$request_uploadform_value = (isset($HTTP_POST_VARS['request_uploadform_value'])) ? intval(trim($HTTP_POST_VARS['request_uploadform_value'])) : "";
} else {
$request_uploadform_value = 1;
}
if (!$sendprocess) {
$remote_media_file = "";
$remote_thumb_file = "";
$image_name = "";
$image_description = "";
$image_keywords = "";
$image_download_url = "";
$image_allow_comments = 1;
}
if ($sendprocess) {
$site_template->register_vars(array(
"cat_id" => $cat_id,
"cat_name" => ($cat_id != 0) ? format_text($cat_cache[$cat_id]['cat_name'], 2) : get_category_dropdown($cat_id)
));
for ($i = 0; $i < $num_counter; $i++) {
$site_template->register_vars(array(
"remote_media_file" => format_text(stripslashes($remote_media_file), 2),
"remote_thumb_file" => format_text(stripslashes($remote_thumb_file), 2),
"image_name" => format_text(stripslashes($image_name), 2),
"image_description" => format_text(stripslashes($image_description), 2),
"image_keywords" => format_text(stripslashes($image_keywords), 2),
"image_allow_comments_yes" => ($image_allow_comments) ? " checked=\"checked\"" : "",
"image_allow_comments_no" => (!$image_allow_comments) ? " checked=\"checked\"" : "",
"image_download_url" => format_text(stripslashes($image_download_url), 2),
"lang_category" => $lang['category'],
"lang_user_upload" => $lang['user_upload'],
"lang_media_file" => $lang['media_file'],
"lang_thumb_file" => $lang['thumb_file'],
"lang_allowed_file_types" => $lang['allowed_mediatypes_desc'],
"allowed_media_types" => str_replace(",",", ",$config['allowed_mediatypes']),
"allowed_thumb_types" => "jpg, gif, png",
"lang_max_filesize" => $lang['max_filesize'],
"lang_max_imagewidth" => $lang['max_imagewidth'],
"lang_max_imageheight" => $lang['max_imageheight'],
"max_thumb_filsize" => $config['max_thumb_size']." ".$lang['kb'],
"max_thumb_imagewidth" => $config['max_thumb_width']." ".$lang['px'],
"max_thumb_imageheight" => $config['max_thumb_height']." ".$lang['px'],
"max_media_filsize" => $config['max_media_size']." ".$lang['kb'],
"max_media_imagewidth" => $config['max_image_width']." ".$lang['px'],
"max_media_imageheight" => $config['max_image_height']." ".$lang['px'],
"lang_image_name" => $lang['image_name'],
"lang_description" => $lang['description'],
"lang_keywords" => $lang['keywords_ext'],
"lang_allow_comments" => isset($lang['allow_comments']) ? $lang['allow_comments'] : "",
"lang_submit" => $lang['submit'],
"lang_reset" => $lang['reset'],
"lang_yes" => $lang['yes'],
"lang_no" => $lang['no'],
"lang_captcha" => $lang['captcha'],
"lang_captcha_desc" => $lang['captcha_desc'],
"captcha_upload" => (bool)$captcha_enable_upload
));
if (!empty($additional_image_fields)) {
$additional_field_array = array();
foreach ($additional_image_fields as $key => $val) {
if ($val[1] == "radio") {
$value = (isset($HTTP_POST_VARS[$key . $i])) ? intval($HTTP_POST_VARS[$key . $i]) : 1;
if ($value == 1) {
$additional_field_array[$key.'_yes'] = " checked=\"checked\"";
$additional_field_array[$key.'_no'] = "";
} else {
$additional_field_array[$key.'_yes'] = "";
$additional_field_array[$key.'_no'] = " checked=\"checked\"";
}
} else {
$value = (isset($HTTP_POST_VARS[$key . $i])) ? format_text(trim($HTTP_POST_VARS[$key . $i]), 1) : "";
}
$additional_field_array[$key] = $value;
$additional_field_array['lang_'.$key] = $val[0];
}
if (!empty($additional_field_array)) {
$site_template->register_vars($additional_field_array);
}
}
} // End for.
} elseif (!$send_process) {
$site_template->register_vars(array(
"cat_id" => $cat_id,
"cat_name" => ($cat_id != 0) ? format_text($cat_cache[$cat_id]['cat_name'], 2) : get_category_dropdown($cat_id),
"remote_media_file" => format_text(stripslashes($remote_media_file), 2),
"remote_thumb_file" => format_text(stripslashes($remote_thumb_file), 2),
"image_name" => format_text(stripslashes($image_name), 2),
"image_description" => format_text(stripslashes($image_description), 2),
"image_keywords" => format_text(stripslashes($image_keywords), 2),
"image_allow_comments_yes" => ($image_allow_comments) ? " checked=\"checked\"" : "",
"image_allow_comments_no" => (!$image_allow_comments) ? " checked=\"checked\"" : "",
"image_download_url" => format_text(stripslashes($image_download_url), 2),
"lang_category" => $lang['category'],
"lang_user_upload" => $lang['user_upload'],
"lang_media_file" => $lang['media_file'],
"lang_thumb_file" => $lang['thumb_file'],
"lang_allowed_file_types" => $lang['allowed_mediatypes_desc'],
"allowed_media_types" => str_replace(",",", ",$config['allowed_mediatypes']),
"allowed_thumb_types" => "jpg, gif, png",
"lang_max_filesize" => $lang['max_filesize'],
"lang_max_imagewidth" => $lang['max_imagewidth'],
"lang_max_imageheight" => $lang['max_imageheight'],
"max_thumb_filsize" => $config['max_thumb_size']." ".$lang['kb'],
"max_thumb_imagewidth" => $config['max_thumb_width']." ".$lang['px'],
"max_thumb_imageheight" => $config['max_thumb_height']." ".$lang['px'],
"max_media_filsize" => $config['max_media_size']." ".$lang['kb'],
"max_media_imagewidth" => $config['max_image_width']." ".$lang['px'],
"max_media_imageheight" => $config['max_image_height']." ".$lang['px'],
"lang_image_name" => $lang['image_name'],
"lang_description" => $lang['description'],
"lang_keywords" => $lang['keywords_ext'],
"lang_allow_comments" => isset($lang['allow_comments']) ? $lang['allow_comments'] : "",
"lang_submit" => $lang['submit'],
"lang_reset" => $lang['reset'],
"lang_yes" => $lang['yes'],
"lang_no" => $lang['no'],
"lang_captcha" => $lang['captcha'],
"lang_captcha_desc" => $lang['captcha_desc'],
"captcha_upload" => (bool)$captcha_enable_upload
));
}
if (!empty($additional_image_fields)) {
$additional_field_array = array();
foreach ($additional_image_fields as $key => $val) {
if ($val[1] == "radio") {
$value = (isset($HTTP_POST_VARS[$key])) ? intval($HTTP_POST_VARS[$key]) : 1;
if ($value == 1) {
$additional_field_array[$key.'_yes'] = " checked=\"checked\"";
$additional_field_array[$key.'_no'] = "";
} else {
$additional_field_array[$key.'_yes'] = "";
$additional_field_array[$key.'_no'] = " checked=\"checked\"";
}
} else {
$value = (isset($HTTP_POST_VARS[$key])) ? format_text(trim($HTTP_POST_VARS[$key]), 1) : "";
}
$additional_field_array[$key] = $value;
$additional_field_array['lang_'.$key] = $val[0];
}
if (!empty($additional_field_array)) {
$site_template->register_vars($additional_field_array);
}
}
$multiupload_content = "";
$counter = 0;
for ($i = 1; $i <= $request_uploadform_value; $i++) {
$lang_multiupload_title_content = preg_replace("/" . $site_template->start . "counter" . $site_template->end . "/siU", $counter + 1, $lang['multiupload_file_title']);
$site_template->register_vars("lang_multiupload_file_title", $lang_multiupload_title_content);
$site_template->register_vars("counter", $counter);
$multiupload_content .= $site_template->parse_template("member_multiupload_form");
$counter++;
}
$site_template->register_vars("member_multiupload_form", $multiupload_content);
$site_template->register_vars("num_counter", $counter);
$content = $site_template->parse_template("member_uploadform");
unset ($multiupload_file_title);
unset ($multiupload_content);
}
(paste full code from
uploadimage and stop right before:
emailuser action).
// Step 2
In lang/english/main.php file,
add in top ?>:
//-----------------------------------------------------
//--- Multiupload (Thunderstrike version) -------------
//-----------------------------------------------------
$lang['multiupload_file_title'] = "File no. {counter}";
$lang['multiupload_media_file_name'] = "Filename: {media_file_name}";
$lang['member_multiuploadform_select'] = "Select the number of images for upload:<br /><span class=\"smalltext\"><font color=\"red\">Note:</font> Check all field before upload.</span>";
$lang['multiupload_select_title'] = "Multiupload - select";
// Step 3
In categories.php file,
find:
//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------
if (!check_permission("auth_upload", $cat_id)) {
$upload_url = "";
$upload_button = "<img src=\"".get_gallery_image("upload_off.gif")."\" border=\"0\" alt=\"\" />";
}
else {
$upload_url = $site_sess->url(ROOT_PATH."member.php?action=uploadform&".URL_CAT_ID."=".$cat_id);
$upload_button = "<a href=\"".$upload_url."\"><img src=\"".get_gallery_image("upload.gif")."\" border=\"0\" alt=\"\" /></a>";
}
replace:
//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------
if (!check_permission("auth_upload", $cat_id)) {
$upload_url = "";
$upload_button = "<img src=\"".get_gallery_image("upload_off.gif")."\" border=\"0\" alt=\"\" />";
}
elseif (check_permission("auth_upload", $cat_id) && isset($config['multiupload_size']) && $config['multiupload_size'] == 1) {
$upload_url = $site_sess->url(ROOT_PATH."member.php?action=uploadform&".URL_CAT_ID."=".$cat_id);
$upload_button = "<a href=\"".$upload_url."\"><img src=\"".get_gallery_image("upload.gif")."\" border=\"0\" alt=\"\" /></a>";
}
elseif (check_permission("auth_upload", $cat_id) && isset($config['multiupload_size']) && $config['multiupload_size'] > 1) {
$upload_url = $site_sess->url(ROOT_PATH."member.php?action=requestuploadform&".URL_CAT_ID."=".$cat_id);
$upload_button = "<a href=\"".$upload_url."\"><img src=\"".get_gallery_image("multiupload.gif")."\" border=\"0\" alt=\"\" /></a>";
}
// Step 4
In lang/english/admin.php file,
add in top ?>:
/*-- Setting-Group XX --*/
$setting_group[XX] = "Multiupload";
$setting['multiupload_size'] = "Set max value for user to upload images to gallery";
Replace
XX with last value in list.
// Step 5
In admin/settings.php file,
find:
show_form_footer($lang['save_changes'], "", 2);
add
before :
show_table_separator($setting_group[XX], 2, "setting_group_XX");
show_setting_row("multiupload_size");
Replace
XX with last value in list.
// Step 6
In templates/your_template/member_uploadform.html file,
find:
<input type="submit" name="uploadbutton" value="{lang_submit}" class="button" />
add
before :
<input type="hidden" name="num_counter" value="{num_counter}">
// Step 7
In templates/your_template - create new file:
member_multiupload_form.html file,
add:
<tr>
<td colspan="2" valign="top" class="head1">{lang_multiupload_file_title}</td>
</tr>
<tr>
<td class="row2" valign="top">
<b>{lang_media_file}</b><br />
<span class="smalltext">
{lang_max_filesize}<b>{max_media_filsize}</b><br />
{lang_max_imagewidth}<b>{max_media_imagewidth}</b><br />
{lang_max_imageheight}<b>{max_media_imageheight}</b><br />
</span>
</td>
<td class="row2">
<b>Upload:</b><br />
<input type="file" name="media_file{counter}" class="input" /><br />
<b>URL:</b><br />
<input type="text" name="remote_media_file{counter}" size="30" value="{remote_media_file}" class="input" /><br />
<span class="smalltext"><b>{lang_allowed_file_types}</b> {allowed_media_types}</span>
</td>
</tr>
<tr>
<td class="row1" valign="top">
<b>{lang_thumb_file}</b><br />
<span class="smalltext">
{lang_max_filesize}<b>{max_thumb_filsize}</b><br />
{lang_max_imagewidth}<b>{max_thumb_imagewidth}</b><br />
{lang_max_imageheight}<b>{max_thumb_imageheight}</b><br />
</span>
</td>
<td class="row1">
<b>Upload:</b><br />
<input type="file" name="thumb_file{counter}" class="input" /><br />
<b>URL:</b><br />
<input type="text" name="remote_thumb_file{counter}" size="30" value="{remote_thumb_file}" class="input" /><br />
<span class="smalltext"><b>{lang_allowed_file_types}</b> {allowed_thumb_types}</span>
</td>
</tr>
<tr>
<td class="row2"><b>{lang_image_name}</b></td>
<td class="row2"><input type="text" name="image_name{counter}" size="30" value="{image_name}" class="input" /></td>
</tr>
<tr>
<td class="row1" valign="top"><b>{lang_description}</b></td>
<td class="row1">
<textarea name="image_description{counter}" cols="30" class="textarea" rows="10" wrap="VIRTUAL">{image_description}</textarea>
</td>
</tr>
<tr>
<td class="row2" valign="top"><b>{lang_keywords}</b></td>
<td class="row2">
<textarea cols="30" class="textarea" rows="10" wrap="VIRTUAL" name="image_keywords{counter}">{image_keywords}</textarea>
</td>
</tr>
// Step 8
In templates/your_template - create new file:
member_multiupload_media.html file,
add:
<table border="0" width="100%" cellpadding="0" cellspacing="0" class="tablebottom">
<tr>
<td class="head1"> {lang_multiupload_media_file_name}</td>
</tr>
<tr>
<td class="row{counter}" align="center"><br />{media}<br /></td>
</tr>
</table>
// Step 9
In templates/your_template - create new file:
member_multiuploadform_select_content.html file,
add:
<option value="{i}">{i}</option>
// Step 10
I attach ZIP file for screenshot and multiupload button so upload in templates/your_template/images folder (or same place for upload.gif file).
// Step 11
In SQL Patches (expert mode),
use:
INSERT INTO 4images_settings (setting_name, setting_value) VALUES ('multiupload_size', '2');
// Integrate with auto-resize
Ok so if use this:
http://www.4homepages.de/forum/index.php?topic=7700.0(step 1 of V@no for member.php file) -
replace:
//--------------------------------------------
//--------- Auto Image Resizing --------------
//--------------------------------------------
if ($config['auto_image'] && !$uploaderror) {
$do_resize = 0;
for ($i = 0; $i < $num_counter; $i++) {
if ($direct_upload) {
$HTTP_POST_FILES['media_file' . $i]['name'] = MEDIA_PATH."/".$cat_id."/".get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name'])));
} else {
$HTTP_POST_FILES['media_file' . $i]['name'] = MEDIA_TEMP_PATH."/".get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name'])));
}
if ($image_info = @getimagesize($HTTP_POST_FILES['media_file' . $i]['name'])) {
if ($image_info[2] == 1 || $image_info[2] == 2 || $image_info[2] == 3) {
$do_resize = 1;
}
}
}
if ($do_resize) {
if (!function_exists(init_convert_options)) {
require(ROOT_PATH.'includes/image_utils.php');
}
if ($image_info[0] > $config['max_image_width'] || $image_info[1] > $config['max_image_height']) {
$convert_options = init_convert_options();
if (!$convert_options['convert_error']) {
$quality = (intval($config['auto_image_quality']) && intval($config['auto_image_quality']) <= 100) ? intval($config['auto_image_quality']) : 100;
for ($i = 0; $i < $num_counter; $i++) {
if (!resize_image($HTTP_POST_FILES['media_file' . $i]['name'], $quality, $config['max_image_width'], 1, $config['max_image_height'])) {
$msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".get_basefile(stripslashes(trim($HTTP_POST_FILES['media_file' . $i]['name'])));
$uploaderror = 1;
}
}
}
}
}
}
//-------------------------------------------
[29-02-2008] - Subject update by Nicky