4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2016, 07:52:38 AM

Login with username, password and session length
Search:     Advanced search
4images is now on facebook. Click here and become a fan!
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Mods & Plugins (Requests & Discussions) (Moderators: mawenzi, Rembrandt)
| | |-+  Download Button to External Site Zip or Html Page ?
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Download Button to External Site Zip or Html Page ?  (Read 6321 times)
Mystic
Pre-Newbie

Offline Offline

Posts: 3

Thank You
-Given: 0
-Receive: 0


View Profile
« 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.
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 560

mmm PHP...


View Profile WWW
« Reply #1 on: October 26, 2005, 02:56:55 PM »

what if you replace in download.php:
1
2
3
4
5
6
7
8
9
10
11
12
    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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*
    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;
//    }
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
Mystic
Pre-Newbie

Offline Offline

Posts: 3

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #2 on: October 27, 2005, 02:06:31 AM »

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
Quote  [Expand]
  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:
Quote  [Expand]
  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.
Logged
Mystic
Pre-Newbie

Offline Offline

Posts: 3

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #3 on: October 27, 2005, 03:11:37 AM »

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
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 560

mmm PHP...


View Profile WWW
« Reply #4 on: October 27, 2005, 03:16:06 AM »

its in includes/functions.php:
1
2
3
    $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&amp;".URL_IMAGE_ID."=".$image_row['image_id'])."\"".$target."><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>" : "";
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
binuj01
Newbie
*
Offline Offline

Posts: 37

Thank You
-Given: 0
-Receive: 0


View Profile WWW
« Reply #5 on: February 26, 2006, 09:14:17 AM »

its in includes/functions.php:
1
2
3
    $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&amp;".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
Logged

www.sourcestravel.com
See your travel destnations ahead.
gamersp
Newbie
*
Offline Offline

Posts: 11

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #6 on: January 11, 2009, 04:52:18 PM »

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!
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.349 seconds with 19 queries.