4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: Mystic on October 26, 2005, 06:11:12 AM
-
I have looked through all the posts and saw a couple about the download button, but nothing specifically to what I am looking for. I would like the visitor to be able to upload a thumbnail and the larger image, but then I would like the Download button to point to the zip file on their site or to an Html webpage on their site, whichever they choose.
In the Admin Panel under "Add Images" there is a field for Download Url. What would be the coding to add that to the member_uploadform. I tested it in the Admin panel and it worked with the zip file, but doesn't work if add a url like http://somesite.com or http://somesite.com/somepage.html. It tries to zip the url. What coding could be used so the download button could go to a plain html page?
I suppose also I could just delete the Download button icons and add a text field below for the Download Url, but the the Download stats would not increment. Thanks for any ideas.
-
what if you replace in download.php:
if (is_remote_file($image_row['image_download_url']) || is_local_file($image_row['image_download_url'])) {
ereg("(.+)\.(.+)", basename($image_row['image_download_url']), $regs);
$file_name = $regs[1];
$file_extension = $regs[2];
$file['file_name'] = $file_name.(($size) ? "_".$size : "").".".$file_extension;
$file['file_path'] = dirname($image_row['image_download_url'])."/".$file['file_name'];
}
else {
$file['file_path'] = $image_row['image_download_url'];
$remote_url = 1;
}
with this:/*
if (is_remote_file($image_row['image_download_url']) || is_local_file($image_row['image_download_url'])) {
ereg("(.+)\.(.+)", basename($image_row['image_download_url']), $regs);
$file_name = $regs[1];
$file_extension = $regs[2];
$file['file_name'] = $file_name.(($size) ? "_".$size : "").".".$file_extension;
$file['file_path'] = dirname($image_row['image_download_url'])."/".$file['file_name'];
}
else {
*/
$file['file_path'] = $image_row['image_download_url'];
$remote_url = 1;
// }
-
Thanks that code worked perfectly. I also modified the member_uploadform and added another row for the Download Url. I checked Member.php and it looked like the coding is already there for it. I added {image_download_url} on the member_upload form.
Edited:
I then modified admin/validateimages.php to get the the URL to show up when I go to validate the image. That way if they provide a link to a website I can check it out before I approve the post.
Old code around line 213 in admin/validateimages.php
show_input_row($lang['field_download_url'].$lang['download_url_desc'], "image_download_url", "", $textinput_size);
Change to this so the url shows when validating:
show_input_row($lang['field_download_url'].$lang['download_url_desc'], "image_download_url", $image_row['image_download_url'], $textinput_size);
By the way, this a great script you have here.
-
One more question. I have looked in download.php. When they click on the download button where do I add coding to get it to open in a new browser window using target="_blank"
Thanks
-
its in includes/functions.php:
$target = (!empty($image_row['image_download_url']) && !is_remote_file($image_row['image_download_url']) && !is_local_file($image_row['image_download_url'])) ? "target=\"_blank\"" : "";
$download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\"".$target."><img src=\"".get_gallery_image("download.gif")."\" border=\"0\" alt=\"\" /></a>";
$download_zip_button = ($target == "" && function_exists("gzcompress") && function_exists("crc32")) ? "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=zip&".URL_IMAGE_ID."=".$image_row['image_id'])."\"".$target."><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>" : "";
-
its in includes/functions.php: $target = (!empty($image_row['image_download_url']) && !is_remote_file($image_row['image_download_url']) && !is_local_file($image_row['image_download_url'])) ? "target=\"_blank\"" : "";
$download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\"".$target."><img src=\"".get_gallery_image("download.gif")."\" border=\"0\" alt=\"\" /></a>";
$download_zip_button = ($target == "" && function_exists("gzcompress") && function_exists("crc32")) ? "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=zip&".URL_IMAGE_ID."=".$image_row['image_id'])."\"".$target."><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>" : "";
I have exactly the same as above in functions.php, but still when I press the download button, it opens in the same window.
Any advice?
Thanks
Binu
-
Hello
I have this problem with 1.7.6, i want to link one picture to a extern zip file, but i cant.
can help me?
thanks!