• [MOD] Alternate directory for download files. 5 0 5 1
Currently:  

Author Topic: [MOD] Alternate directory for download files.  (Read 224067 times)

0 Members and 1 Guest are viewing this topic.

Offline cardsup

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [MOD] Alternate directory for download files.
« Reply #15 on: June 08, 2005, 09:10:46 PM »
Hi Chris,

I am using your hack for the download function and it works great! Thank you!

I have a question -- I need my users to download zipped .esp files instead of the jpg files in the gallery. Since 4images does not support .esp files (as far as I know) I have the files prezipped. However, when I put those files in the 'download' folder, the script can not find them and instead the user downloads the jpg file.

Is there a way I can fix that so the user can download the zipped esp file?

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] Alternate directory for download files.
« Reply #16 on: July 09, 2005, 08:34:15 PM »
Hi, Thanks for the Mod. I was looking for something like it. And its working with out any error.

I just want to change something. Actually I want to change "cat_id/download" to something Unique. Say "cat_id/a1b2c3d4"

SO will it work if I change?
Code: [Select]
// Let the user download the "<cat_id>/download/<fname>", "<cat_id>/big/<fname>", or "<cat_id>/<fname>" version of the image
$temp = get_file_path($file['file_name'], "download", $image_row['cat_id'], 0, 1);
TO something like
Code: [Select]
// Let the user download the "<cat_id>/a1b2c3d4/<fname>", "<cat_id>/big/<fname>", or "<cat_id>/<fname>" version of the image
$temp = get_file_path($file['file_name'], "a1b2c3d4", $image_row['cat_id'], 0, 1);

May be I have to do this 2/3 times. But will it work?

Its just coz I m using 4images for wallpapers. And file name r in sequence. So if someone knows Category ID, he can start downloading "Actually" files dirctly from browser"domin.com/4images/data/media/2/download/filename"

So just want to protect that so that no one can download files directly. 
I m not a  Programmer.
          But
I m a Good Learner.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Alternate directory for download files.
« Reply #17 on: July 09, 2005, 08:40:52 PM »
no, u'll need search in the new code for MEDIA_PATH and replace "download" there.
for example:
Quote
   if( file_exists(MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file']) )
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)

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] Alternate directory for download files.
« Reply #18 on: July 11, 2005, 09:06:39 AM »
Thankx V@no. Successfully changed that.

I m going to ask something here. Not sure if its the right thread or ...

Is it possible that when users upload a file. It goes to ---> "/media/cat-id/download/file" (Actual file, would be minimum 800*600)

And a resized version can be made either by admin panel or right at the moment when file get upload.
And that goes to --->"media/cat-id/filename"



I m not a  Programmer.
          But
I m a Good Learner.

Offline geohei

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: [MOD] Alternate directory for download files.
« Reply #19 on: July 23, 2005, 12:21:17 AM »
Sorry, I got it all and it works great, but what is meant by this here :?:

Open details.html and add something like this to use the new download information:
Code: [Select]
          <tr>
            <td>{download_image_file_size} [{download_width}x{download_height}]</td>
          </tr>

Offline geohei

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: [MOD] Alternate directory for download files.
« Reply #20 on: August 04, 2005, 02:10:30 PM »
No answer yet on previous posting ... :(

Just to clarify ... the code is at the very end of posting No. 6 (by Chris).

I don't know what he means with this code box:
No answer yet on previous posting :(
Please have a look at the 6th posting of the following link (by Chris)
http://www.4homepages.de/forum/index.php?topic=7499.0

I don't get what he means with the last "code" box :?:

Open details.html and add something like this to use the new download information:
Code: [Select]
          <tr>
            <td>{download_image_file_size} [{download_width}x{download_height}]</td>
          </tr>

Can someone please explain ...

Many thanks!

Offline geohei

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: [MOD] Alternate directory for download files.
« Reply #21 on: August 15, 2005, 10:59:12 PM »
I found where to put it. It's in the template code.

But where shall I put it?

Thanks.

Offline loz

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: [MOD] Alternate directory for download files.
« Reply #22 on: August 17, 2005, 11:35:00 AM »
Is there any way in which I can utilise the Batch Upload process to recognise the Download folder for appropriate images as I have tons of images to upload that are in several categories?

Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [MOD] Alternate directory for download files.
« Reply #23 on: August 17, 2005, 02:59:00 PM »
I installed this mod an on detailed.html there is the correct filesize there is a big image in the big folder
but when I click on Download or Zip-Download still only the small resized image is downloaded  :?

Do you have any suggestions?
Matthias

Offline geohei

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: [MOD] Alternate directory for download files.
« Reply #24 on: August 17, 2005, 09:14:16 PM »
I installed this mod an on detailed.html there is the correct filesize there is a big image in the big folder
but when I click on Download or Zip-Download still only the small resized image is downloaded  :?

Do you have any suggestions?
Matthias
My .zip contains the big image :!:

HTH

Offline bartes

  • Pre-Newbie
  • Posts: 2
    • View Profile
    • Private Photos
Re: [MOD] Alternate directory for download files.
« Reply #25 on: August 31, 2005, 12:55:22 PM »
Hi all!

I have the same prob than Matias... Everything seems to be ok but download and download ZIP contains the smaller version from details page... The most interestin thing is that on detail page, near download button it shows correct info about FileSize (big one), but incorect ImageResolution (detai one). Big photos are in "big" folder...

Any ideas how to correct it? You can see it on http://www.galeria.bartes.pl/

Thanks for advice...

Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [MOD] Alternate directory for download files.
« Reply #26 on: September 04, 2005, 07:35:44 PM »
Hi bartes,
I found a solution, but I really remember all my changes :-(

I think I've changed some pathes in the code for the big folder.
There is also a path /download/ before the path /big/ (don't know for what the /download/ path is?)

I think I've just changed the /dowload/ path to /big/ and everything was O.K.

Matthias


Offline nyiguinyogui

  • Pre-Newbie
  • Posts: 6
    • View Profile
Re: [MOD] Alternate directory for download files.
« Reply #27 on: October 06, 2005, 11:32:50 AM »
Hello,
Two small addons to:

1) WHEN A NEW CATEGORY IS CREATED, CREATE ITS DOWNLOAD DIR
In:
admin/categories.php
   
Locate:
Code: [Select]
create_cat_folder(MEDIA_PATH."/".$cat_id, CHMOD_DIRS);   
Add after:
Code: [Select]
create_cat_folder(MEDIA_PATH."/".$cat_id."/download", CHMOD_DIRS);   

2) DOWNLOAD BIG VERSION OF IMAGE FROM LIGHTBOX:
   
In:
/download.php
   
Locate:
Code: [Select]
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
$file_name = $image_row['image_media_file'];
   
Replace by:
Code: [Select]
$file_name = $image_row['image_media_file'];
$temp = MEDIA_PATH."/".$image_row['cat_id']."/download/".$file_name;
if( !file_exists($temp) )
$temp = MEDIA_PATH."/".$image_row['cat_id']."/".$file_name;
$file_path = $temp;
//$file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
//$file_name = $image_row['image_media_file'];
   
NOTE: For those who installed the MOD "Whole/part category download" (http://www.4homepages.de/forum/index.php?topic=3479.0): You'll find the previous code twice. So replace it in both places and you will get the big version of image when you download the whole lightbox and also when you download the whole category.

Hope this helps.

Regards.

Offline webslingers

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: [MOD] Alternate directory for download files.
« Reply #28 on: November 04, 2005, 09:24:29 AM »
I have just added this mod. It works great! I have one request. Some of my larger files are images, while others that are going to be in the download folder with the larger images are going to be zip files. Is there a way for it just to look for the first part of the name or any other way for it to look for images and files? I need it to be able to download images and zips.

Thanks to everyone.

Offline geohei

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: [MOD] Alternate directory for download files.
« Reply #29 on: November 17, 2005, 08:14:52 PM »
...
2) DOWNLOAD BIG VERSION OF IMAGE FROM LIGHTBOX:
...

Hmmm ... where can you download a file inside the Lightbox? When I display the Lightbox, I get the thumbs. Clicking on a thumb pops up the the detail page, which offers the download feature. However the Lightbox does not directly offer a download :?: :!:

Where's the misunderstanding ... :?:

Thanks,