4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: stomi on May 19, 2003, 11:55:26 AM
-
Hi all.
I want to simplify the image upload for users.
The existing process looks like this:
First I browse the harddisk for an image file:
(http://nbc.wakeforum.de/data/media/3/screen1.jpg)
Then I have to choose a file-name.
I removed the thumbnail fields, because I use auto-thumbnailing.
Then i click submit and after a successful upload the following screen comes up:
(http://nbc.wakeforum.de/data/media/3/screen2.jpg)
---------------------------------------------
Now I got 2 requests:
At first, i don't want that "Image Name" is a mandatory field.
If the user decides to leave the "Image Name" field empty, the file name should be the Image name automatically.
Is this possible?
Second one: After successfully uploading an image, the image shouldn't be displayed. A short success message would be enough. The Image upload fields should be up again, so that the user can quickly upload another image.
Are there already mods doing that?
Is it much effort?
Help is appreciated.
Thanks, K.
-
Are there already mods doing that?
Is it much effort?
No ;)
Here is a quick fix for that ;)
open /member.php
find: if ($image_name == "") {
$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;
}
comment it or simply remove it ;)
then find:$current_time = time();
add after:if (!$image_name)
{
$image_name = $HTTP_POST_VARS['image_name'] = get_file_name($new_name);
}
now, image name entry is not necerry, it will use filename (without extention) if its empty.
to fix the "after upload" page, just find:$content .= "<table border=\"0\" align=\"center\">\n<tr>\n<td>\n".$media."\n</td>\n</tr>\n</table>\n";
add after:$action = "uploadform";
that's all.
but if u'd like it remmber the fields (image name, keywords, description)
also add:$sendprocess = 1;
good luck ;)
-
yeah.. that works great.
10000000 thanks @ v@no.
now picture upload is very fast and comfortable
-
a little question about this one, V@no you said:
open /member.php
find:Code:
if ($image_name == "") {
$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;
}
comment it or simply remove it
i my member.php there are two of these codes, does this mean i delete both of them?
thnx.
-
I dont know, because I have just one, default 4images has just one part with that code. its in if ($action == "uploadimage") {...} part (just scroll up a little bit to see what $action is being execute.
-
hey vano it doesnt work for me is there anyway i can download your member.php ? thx
-
hey vano it doesnt work for me
sorry to hear that.
is there anyway i can download your member.php ?
U could, but I dont think u want it. I'm 102% sure it will not work for u at all ;)
-
why it will not work ?? is there other way ? :cry:
-
why it will not work ??
Look at V@nos Site and you will see that he has many modifications on his Site and in the member.php...
And thats the way why his member.php dont work with your Gallery... (o:
-
why it will not work ?? is there other way ?
Xmode: I made the same mistake and couldn't figure out why the changes wouldn't work. Until I looked closer.
When you search for this:
if ($image_name == "") {
$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;
}
Make sure it is 39 lines below this code:
if ($action == "uploadimage") {
Make sure you DO NOT comment the code below this:
if ($action == "updateimage") {
Once you make those changes it will work! :wink:
-
I just found a bug with this method, the keywords not being populated...
To fix that, in member.php instead of $image_name = ($image_name) ? $image_name : get_file_name($new_name);
use:if (!$image_name)
{
$image_name = $HTTP_POST_VARS['image_name'] = get_file_name($new_name);
}
P.S. I've updated my original post.
-
I dont know, because I have just one, default 4images has just one part with that code. its in if ($action == "uploadimage") {...} part (just scroll up a little bit to see what $action is being execute.
Interestingly i have the same issue.. follwing are the two instances of if ($action == "uploadimage") {...} if ($image_name == ""){...} part: :roll: (I have commented them both and it seems to be working.)
Line 329 - 359
if ($action == "updateimage") {
if (!$image_id || ($config['user_edit_image'] != 1 && $user_info['user_level'] != ADMIN)) {
show_error_page($lang['no_permission']);
}
$sql = "SELECT image_id, cat_id, user_id, image_name
FROM ".IMAGES_TABLE."
WHERE image_id = $image_id";
$image_row = $site_db->query_firstrow($sql);
if (!$image_row || $image_row['user_id'] <= USER_AWAITING || ($user_info['user_id'] != $image_row['user_id'] && $user_info['user_level'] != ADMIN)) {
show_error_page($lang['no_permission']);
exit;
}
$txt_clickstream = get_category_path($image_row['cat_id'], 1).$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" class=\"clickstream\">".$image_row['image_name']."</a>".$config['category_separator'];
$txt_clickstream .= $lang['image_edit'];
$error = 0;
$image_preview = (isset($HTTP_POST_VARS['image_preview'])) ? 1 : 0;
$image_name = un_htmlspecialchars(trim($HTTP_POST_VARS['image_name']));
$image_description = un_htmlspecialchars(trim($HTTP_POST_VARS['image_description']));
$image_keywords = un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords']));
$image_keywords = preg_replace("/[\n\r]/is", " ", $image_keywords);
$image_keywords = str_replace(","," ",$image_keywords);
$image_keywords = ereg_replace("( ){2,}", " ", $image_keywords);
// if ($image_name == "") {
// $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;
// }
Line 491 - 537
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'];
$remote_media_file = format_url(un_htmlspecialchars(trim($HTTP_POST_VARS['remote_media_file'])));
$remote_thumb_file = format_url(un_htmlspecialchars(trim($HTTP_POST_VARS['remote_thumb_file'])));
$image_preview = (isset($HTTP_POST_VARS['image_preview'])) ? 1 : 0;
$image_name = un_htmlspecialchars(trim($HTTP_POST_VARS['image_name']));
$image_description = un_htmlspecialchars(trim($HTTP_POST_VARS['image_description']));
$image_keywords = un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords']));
$image_keywords = preg_replace("/[\n\r]/is", " ", $image_keywords);
$image_keywords = str_replace(","," ",$image_keywords);
$image_keywords = ereg_replace("( ){2,}", " ", $image_keywords);
$image_active = (isset($HTTP_POST_VARS['image_active']) && $HTTP_POST_VARS['image_active'] == 0) ? 0 : 1;
$image_allow_comments = (isset($HTTP_POST_VARS['image_allow_comments']) && $HTTP_POST_VARS['image_allow_comments'] == 0) ? 0 : 1;
$image_download_url = (isset($HTTP_POST_VARS['image_download_url'])) ? format_url(un_htmlspecialchars(trim($HTTP_POST_VARS['image_download_url']))) : "";
$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;
}
if ((empty($HTTP_POST_FILES['media_file']['tmp_name']) || $HTTP_POST_FILES['media_file']['tmp_name'] == "none") && ($remote_media_file == "" || !check_remote_media($remote_media_file))) {
$error = 1;
$msg .= (($msg != "") ? "<br />" : "").$lang['image_file_required'];
}
// if ($image_name == "") {
// $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;
// }
any clues?
2nd question:
How can i replace the (_) underscores of file name to ( ) spaces in the Image Name?
-
any clues?
The first instance is for edit images, you should leave it intact, but the second instanse is what you are looking for.
2nd question:
How can i replace the (_) underscores of file name to ( ) spaces in the Image Name?
replace $image_name = $HTTP_POST_VARS['image_name'] = get_file_name($new_name);
with: $image_name = $HTTP_POST_VARS['image_name'] = str_replace("_", " ", str_replace("%20", " ", get_file_name($new_name)));
-
Awesome... Thanks! V@no... u the man.
-
I have this code in my member.php file:
$content .= "<table border=\"0\" align=\"center\">\n<tr>\n<td>\n".$media."\n</td>\n</tr>\n</table>\n";
}
else {
$action = "uploadform";
$sendprocess = 1;
}
}
else {
$action = "uploadform";
$sendprocess = 1;
}
}
But its not working. This is straight from the original member.php file with 1.7.2... But yet on my other site with the same code it is working?!? Any suggestions would be appreciated! It was working before applying the update.
-
It's working!!! :D :D :D :D :D :D :D :D
Thanks Vano and friends!!!
-
This is exactly the MOD I need, thanks.
However, is it compatible with 1.7.10?
I just upgraded to 1.7.10 and modified the file to apply this MOD.
However, the system still ask me to input the image name.
Does anyone know what the problem might be?
Thank you very much.
-
Few another question....
If i change this path in member.php
$file = (is_remote($new_name)) ? $new_name : (($direct_upload) ? MEDIA_PATH."/".$cat_id."/".$new_name : MEDIA_TEMP_PATH."/".$new_name);
On
$file = (is_remote($new_name)) ? $new_name : (($direct_upload) ? THUMB_PATH."/".$cat_id."/".$new_name : THUMB_TEMP_PATH."/".$new_name);
It will show me thumbnail... But how can i apply a link to big photo for thumbnail? (By click on thumbnail, open direct link to photo)
Many thanks!
-
Hello,
instead of using the file name as a image name in my gallery, i would like the Mod to be adding the category name with a number at the end.
e.g: Category name: "Test"
When uploading image #1 the name should be "Test 001", #2 should be "Test 002" and so on.
Is there an easy way to implement this Mod?
Thank you very much in advance!
Greetings!