4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: loz on April 19, 2005, 04:29:08 PM

Title: [MOD] Alternate directory for download files.
Post by: loz on April 19, 2005, 04:29:08 PM
Hi,

Code Update !   http://www.4homepages.de/forum/index.php?topic=7499.msg148451#msg148451 @rembrandt

I'm trying to make an image gallery which will enable users download very big files. The problem is that if I stick these 4mb files into the media folder and into the appropriate category they show up on the detail page.

All I want is to do is to make a separate folder on my server for the big 4mb files which is only available to download when triggered by a user clicking 'download' (and zip download) on the detail page and also when they visit their 'Lightbox' to download the images together. I don't want the big image to load up in a new window, just a simple download.

I've got about 1000 images to upload, so I don't want to assign every image with a download url in the Admin panel.

Ideally I would like to login to the admin panel, go to 'check new images', check for all of them in every category then upload to the database (thumbnails are already in the 'thumbnail' folder on the server). I guess because the images will all have the same filename in each different folder the download buttons just need to be linking to a different folder on the server and then my problem should be solved.

I know there are similar topics on this and I have tried my patience with them all, installed them and they either don't work or aren't quite what I am looking for.

Please help because I can see it being a relatively easy mod and I'm sure will help others who have been confused by the topics like 'Different download options / Verschiedene Download Möglichke' & '[Mod] Image/Media In New Window (easy/more practical)'.

Thanks,

Loz
Title: Re: [MOD] Alternate directory for download files.
Post by: martrix on April 19, 2005, 05:11:37 PM
Try to search for phpThumb on the forum and on Google...

it will partially increase the server's computing time, but if caching is on and working well, than it will only be for the first time a user opens a page-detail.

In that case: a smaller picture of a max-size would be shown on the details page and the download buttong would lead directly to the huge file...

without needs to change the php-code of 4images...
and you can upload the files once and as you are used to  :o
Title: Re: [MOD] Alternate directory for download files.
Post by: loz on April 19, 2005, 05:17:39 PM
Hi,

Thanks for that but I don't want to use that method because as you say it will increase server load especially if lots of people are doing the same thing - it's 4mb each file!

Please advise of a way to change the download button to link to the larger files and it will stop me pestering you - honest!

Thanks, Loz
Title: Re: [MOD] Alternate directory for download files.
Post by: martrix on April 19, 2005, 05:26:18 PM
It was just an advice...  :) because I don't know it better  :wink:

Take it or leave it  :wink:

But I do not really agree: once the "thumbnail" is created, the thumbnail cache works well and the cache-timeout is set well it won't increase the server-load more than once per file - no matter how many times the image will be shown  :)
Title: Re: [MOD] Alternate directory for download files.
Post by: loz on April 19, 2005, 06:14:59 PM
One other thing I would need is for the filesize info on the details page to be same as the downloadable image, not the detail page image. Hope someone can help.
Title: Re: [MOD] Alternate directory for download files.
Post by: Chris on April 20, 2005, 02:53:59 AM
Lucky you!  I've already done this.  :wink:

Open download.php, locate this line:
Code: [Select]
    $file['file_path'] = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".$file['file_name'];
Change it to:
Code: [Select]
//    $file['file_path'] = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".$file['file_name'];
    // 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);
if( !file_exists($temp) )
  $temp = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".$file['file_name'];
$file['file_path'] = $temp;

Open includes/functions.php and locate this code:
Code: [Select]
    if ($file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
      $file_size = format_file_size($file_size);
    }

Immediately after that, add this:
Code: [Select]
// CTN download file block insert BEGIN
if( file_exists(MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file']) )
  $download_file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file']);
    elseif( file_exists(MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file']) )
  $download_file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file']);
    $download_file_size = format_file_size($download_file_size);
// CTN download file block insert END

Locate:
Code: [Select]
  $file_size = "n/a";
  if (!is_remote($image_row['image_media_file'])) {
    if ($file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
      $file_size = format_file_size($file_size);
    }
  }
  elseif ($detailed_view) {
    $file_size = get_remote_file_size($image_row['image_media_file']);
  }

Replace with:
Code: [Select]
  $file_size = "n/a";
  $download_file_size = "n/a";  // Download file
  if (!is_remote($image_row['image_media_file'])) {
    if ($file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
  $download_file_size = $file_size;  // Download file
      $file_size = format_file_size($file_size);
    }
// Download file Block BEGIN
if( file_exists(MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file']) )
  $download_file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file']);
    elseif( file_exists(MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file']) )
  $download_file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file']);
    $download_file_size = format_file_size($download_file_size);
// Download file Block END
  }
  elseif ($detailed_view) {
    $file_size = get_remote_file_size($image_row['image_media_file']);
  }

Locate:
Code: [Select]
    "url_download" => $site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id']),
Add after:
Code: [Select]
    "download_image_file_size" => $download_file_size,  // Download file
Locate:
Code: [Select]
    if ($image_info = @getimagesize($src, $info)) {
      $width_height = " ".$image_info[3];
      $width = $image_info[0];
      $height = $image_info[1];

Add after:
Code: [Select]
      $download_width_height = $width_height; // Download file
      $download_width = $width; // Download file
      $download_height = $height; // Download file

Locate:
Code: [Select]
  else {
    $check_handle = "check_".$image_type."_type";
    $path = (($image_type == "media") ? (($cat_id) ? MEDIA_PATH."/".$cat_id : MEDIA_TEMP_PATH) : (($cat_id) ? THUMB_PATH."/".$cat_id : THUMB_TEMP_PATH))."/".$file_name;
    return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $path) : $return_code;
  }

Replace with:
Code: [Select]
  else {
    $check_handle = "check_".$image_type."_type";
//    $path = (($image_type == "media") ? (($cat_id) ? MEDIA_PATH."/".$cat_id : MEDIA_TEMP_PATH) : (($cat_id) ? THUMB_PATH."/".$cat_id : THUMB_TEMP_PATH))."/".$file_name;
//    return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $path) : $return_code;
// Download file block insert BEGIN
    switch( $image_type ) {
  case "media":
    if( $cat_id )
      $path = MEDIA_PATH."/".$cat_id;
else
  $path = MEDIA_TEMP_PATH;
    break;
      case "big":
        $path = MEDIA_PATH."/".$cat_id."/big";
    break;
      case "download":
        $path = MEDIA_PATH."/".$cat_id."/download";
    break;
  default:
    if( $cat_id )
      $path = THUMB_PATH."/".$cat_id;
else
  $path = THUMB_TEMP_PATH;
    break;
}
$path .= "/".$file_name;
// Download file block insert END
    return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $path) : (($image_type != "big" && $image_type != "download") ? $return_code : ""); // Download file :: V@no big mod
  }

Locate:
Code: [Select]
    $site_template->register_vars(array(
      "media_src" => $media_src,
      "media_icon" => $media_icon,
      "image_name" => $image_name,
      "width_height" => $width_height,
      "width" => $width,
      "height" => $height,
      "iptc_info" => $iptc_info
    ));

Replace with:
Code: [Select]
// Download file info insert BEGIN
    $download_file_src = get_file_path($media_file_name, "download", $cat_id, 0, 1);
    $src_download = (!file_exists($download_file_src) && file_exists(preg_replace("/\/{2,}/", "/", get_document_root()."/".$download_file_src))) ? preg_replace("/\/{2,}/", "/", get_document_root()."/".$download_file_src) : $download_file_src;
    if ($temp = @getimagesize($src_download)) {
      $download_width_height = " ".$temp[3];
      $download_width = $temp[0];
      $download_height = $temp[1];
    }
// Download file info insert END

    $site_template->register_vars(array(
      "media_src" => $media_src,
      "media_icon" => $media_icon,
      "image_name" => $image_name,
      "width_height" => $width_height,
      "width" => $width,
      "height" => $height,
      "download_width" => $download_width, // Download file
      "download_height" => $download_height, // Download file
      "iptc_info" => $iptc_info
    ));

Replace the very last line:
Code: [Select]
?>
With:
Code: [Select]
// Download file block insert BEGIN
function check_remote_download($remote_media_file) {
  global $config;
  return (preg_match("#^(https?:\/\/[a-z0-9\-]+?\.([a-z0-9\-]+\.)*[a-z]+(:[0-9]+)*\/.*?\.(".$config['allowed_mediatypes_match'].")$)#is", $remote_media_file)) ? 1 : 0;
}
function check_local_download($local_media_file) {
  global $config;
  return (preg_match("#^((\.)*\/.*?\.(".$config['allowed_mediatypes_match'].")$)#is", $local_media_file)) ? 1 : 0;
}
function check_download_type($file_name) {
  global $config;
  return (in_array(get_file_extension($file_name), $config['allowed_mediatypes_array'])) ? 1 : 0;
}
// Download file block insert END
?>

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>

With these changes you can place your download files in a subdirectory under the category id folder where you upload your images using FTP.

So the code will look for your download images in:

category_id/download
category_id

Your download image files must have the same name as the image file used on the details page.  Just upload everything using FTP and the CHECK NEW IMAGES admin CP function.
Title: Re: [MOD] Alternate directory for download files.
Post by: loz on April 20, 2005, 12:29:42 PM
Hi Chris,

I've just tried it and it doesn't work. I'm getting error messages when clicking 'Download', saying:

Code: [Select]
Fatal error: Call to undefined function: check_download_type() in /usr/local/psa/home/vhosts/mydomain.com/httpdocs/4images/includes/functions.php on line 120

Are you using an older version? Mine's 1.7.1
Title: Re: [MOD] Alternate directory for download files.
Post by: V@no on April 20, 2005, 02:47:29 PM
I dont see any reference to check_download_type neither in v1.7.1 itself nor in the code Chris posted...
Title: Re: [MOD] Alternate directory for download files.
Post by: Chris on April 21, 2005, 12:23:41 AM
 :oops: Sorry, I had a feeling I was leaving something out.  I'll update the previous post

Turns out I missed quite a lot.  Try it now and see if it's any better
Title: Re: [MOD] Alternate directory for download files.
Post by: loz on April 22, 2005, 11:36:42 AM
Congratulations Chris.......... SUCCESS!!!

Just one change I had to make in order for your MOD to work was to ignore this first bit of code change in includes/functions.php:

FIND:
    if ($file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
      $file_size = format_file_size($file_size);
    }


Immediately after that, add this:

Code:
// CTN download file block insert BEGIN
   if( file_exists(MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file']) )
     $download_file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file']);
    elseif( file_exists(MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file']) )
     $download_file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file']);
    $download_file_size = format_file_size($download_file_size);
// CTN download file block insert END

-------------------------------
I think this was left in from the original code you made. If you made this change and then tried to make the next change you wouldn't find the script to change!!! Let me know if it's any different.

Another problem is that when you add the image to the lightbox, you don't download the big/downloadable file but the detail page image instead. I'd really appreciate it if you could solve this.

Once you've updated it and fixed the lightbox problem, this is a great simple MOD. You don't have to trail through loads of posts and several updates like this board has. Someone should really clean up the code and make it available on the first page (or set-up a new Completed MODs page).

Title: Re: [MOD] Alternate directory for download files.
Post by: Chris on April 23, 2005, 02:17:46 AM
Frankly my time is so limited this time of year and it gets even less available during the summer.  I'll see what I can do.
Title: Re: [MOD] Alternate directory for download files.
Post by: loz on April 25, 2005, 03:05:10 PM
Please can you tell me how to fix the Lightbox problem. When you add the image to the lightbox, you don't download the 'big/downloadable' folder file/s but the detail page image/s instead. I really need the large images downloading in the Lightbox download. Please help! Thanks.
Title: Re: [MOD] Alternate directory for download files.
Post by: Chris on April 26, 2005, 02:01:13 AM
Please be more specific next time.  The download works find from the download link under the thumbnails when viewing the images.  You must be talking about the zip download which wasn't obvious to me.

Open download.php and locate:
Code: [Select]
        $file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
Replace it with:
Code: [Select]
//        $file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
// Download file block insert BEGIN
    // Let the user download the "<cat_id>/download/<fname>", "<cat_id>/big/<fname>", or "<cat_id>/<fname>" version of the image
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file'];
if( !file_exists($file_path) )
      $file_path = MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file'];
if( !file_exists($file_path) )
  $file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
// Download file block insert END
Title: Re: [MOD] Alternate directory for download files.
Post by: loz on April 26, 2005, 09:57:28 AM
That's great Chris, thanks very much (again).

One question, would it be possible to change the 'send ecard' so it sends the recipient the big/downloadable image via email but still has the detail page image as the preview? (I hope this question is clear)

Thanks for all your help, it's really appreciated!
Title: Re: [MOD] Alternate directory for download files.
Post by: Chris on April 26, 2005, 02:44:05 PM
That's a big departure from the current behavior of sending a link to the details page by email.  So no, I don't have the time or the interest to do that much coding.  Sorry.

Honestly, if the user gets the postcard link, you can just edit your template and category permissions to allow them to download the larger image from there.
Title: Re: [MOD] Alternate directory for download files.
Post by: cardsup 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?
Title: Re: [MOD] Alternate directory for download files.
Post by: Fastian 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. 
Title: Re: [MOD] Alternate directory for download files.
Post by: V@no 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']) )
Title: Re: [MOD] Alternate directory for download files.
Post by: Fastian 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"



Title: Re: [MOD] Alternate directory for download files.
Post by: geohei 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>
Title: Re: [MOD] Alternate directory for download files.
Post by: geohei 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!
Title: Re: [MOD] Alternate directory for download files.
Post by: geohei 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.
Title: Re: [MOD] Alternate directory for download files.
Post by: loz 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?
Title: Re: [MOD] Alternate directory for download files.
Post by: Matthias70 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
Title: Re: [MOD] Alternate directory for download files.
Post by: geohei 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
Title: Re: [MOD] Alternate directory for download files.
Post by: bartes 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...
Title: Re: [MOD] Alternate directory for download files.
Post by: Matthias70 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

Title: Re: [MOD] Alternate directory for download files.
Post by: nyiguinyogui 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.
Title: Re: [MOD] Alternate directory for download files.
Post by: webslingers 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.
Title: Re: [MOD] Alternate directory for download files.
Post by: geohei 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,
Title: Re: [MOD] Alternate directory for download files.
Post by: Matthias70 on November 17, 2005, 08:16:59 PM
Hi geohei
at the top on the right side there are text links: delete lightbox and download lightbox

Matthias
Title: Re: [MOD] Alternate directory for download files.
Post by: geohei on November 17, 2005, 08:23:00 PM
Hi geohei
at the top on the right side there are text links: delete lightbox and download lightbox

Matthias
Thanks. Got it now.

However my .zip contains already the big images. Hence ... I don't require the mod code from nyiguinyogui. Strange :roll:
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on December 12, 2005, 06:16:32 PM
Wie bekomme ich den folgende Sachen hin:

-Download der big-Datei
-Zip-Download der big-Datei
-Original-Auflösung der big-Datei
-Big-Datei in den Leuchtkasten

Ich habe schon viel danach gesucht, aber leider auch nicht die Lösung gefunden!

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: geohei on December 12, 2005, 10:29:07 PM
Wie bekomme ich den folgende Sachen hin:

-Download der big-Datei
-Zip-Download der big-Datei
-Original-Auflösung der big-Datei
-Big-Datei in den Leuchtkasten

Ich habe schon viel danach gesucht, aber leider auch nicht die Lösung gefunden!

Fireball22
All das geht bei mir. Habe alle Infos aus diesem Thread (mit Unterlinks).
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on December 13, 2005, 02:12:11 PM
Ich kann leider noch nicht so gut Englisch und hab wirklich nichts gefunden.

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: Acidgod on December 13, 2005, 02:53:08 PM
Also ich bin mir sicher das Du in jeden der Themen schon reingeschaut oder soagr geschrieben hast... (o:

Also Du hast es doch mit dem Big Folder schon umgesetzt oder?

Dann baue nur noch dieses Teil ein und zack hast Du alles fertig...
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on December 13, 2005, 04:45:14 PM
Welchen Teil meinst du?
Das was hier oben schon aufgeführt wurde, habe ich schon integriert, funktioniert aber nicht, bzw. nur Teilweiße, also nur die Anzeige der Originalgröße, das andere habe ich gar nicht gefunden und die Anzeige der Auflösung ging nicht.

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: Acidgod on December 13, 2005, 04:54:50 PM
Na die änderungen hier im Thread lösen das Download/Download als zip/Leuchtkasten Download Problem.
Und mit den Änderungen am Template bekommste sogar die Download Auflösung & Größe angezeigt...
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on December 13, 2005, 06:13:25 PM
OK, das mit dem download lese ich dann nochmal super genau nach.
Aber das mit der Auflösung funktioniert wirklich nicht, habs eingebaut und die Auflösung vom Thumbnail wird angezeigt!

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: Acidgod on December 13, 2005, 07:00:53 PM
ohje... das geht erst wenn du alles aus diesem Thema eingebaut hast!
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on December 14, 2005, 03:16:43 PM
Achso ok, dann mach ich das mal!

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on December 17, 2005, 11:25:14 AM
Ok, ich habe jetzt folgendes eingebaut:

http://www.4homepages.de/forum/index.php?topic=7499.msg33712#msg33712
+
http://www.4homepages.de/forum/index.php?topic=7499.msg34056#msg34056
+
http://www.4homepages.de/forum/index.php?topic=7499.msg34466#msg34466

Aber es geht nicht mehr außer dem download des Leuchtkastens in original-größe!
Was muss ich denn noch einbauen?

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: Matthias70 on December 17, 2005, 11:31:55 AM
Ok, ich habe jetzt folgendes eingebaut:

http://www.4homepages.de/forum/index.php?topic=7499.msg33712#msg33712
+
http://www.4homepages.de/forum/index.php?topic=7499.msg34056#msg34056
+
http://www.4homepages.de/forum/index.php?topic=7499.msg34466#msg34466

Aber es geht nicht mehr außer dem download des Leuchtkastens in original-größe!
Was muss ich denn noch einbauen?

Hallo Fireball22,
alle oben genannten Mods bestehen aus jeweils drei Seiten. Drei Mods mal 3 Seiten sind insgesamt 9 Seiten mit Tipps und Hinweisen wie man die Erweiterungen, die du wünscht einbauen kann. Hast du wirklich alle 9 Seiten genau durchgelesen?

Matthias
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on December 17, 2005, 11:36:38 AM
Sorry, aber wo sind jeweils die drei Seiten?
Das ist doch alles ein Thread mit drei Seiten?!

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: Matthias70 on December 17, 2005, 11:42:27 AM
Sorry, aber wo sind jeweils die drei Seiten?
Das ist doch alles ein Thread mit drei Seiten?!

Fireball22

Ja genau das meinte ich. Hab mich vielleicht etwas unglücklich ausgedrückt.
Was ich sagen wollte. Die Mods und deren Kombination funktionieren. Alles was du möchtest steht jeweils auf den Folgeseiten des jeweiligen Mods. Warum das nur bei dir nicht klappt, kannst eigentlich nur du herausfinden. Es sei denn du hast eine Fehlermeldung, die du hier posten kannst...
Um dir zu helfen, müsste sich jemand bereit erklären, alle drei Mods genau durchzulesen, evtl nochmals neu einzubauen.
Du weißt was das für eine Arbeit wäre.
Das kannst nur du selbst...

viele Grüße
Matthias
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on December 17, 2005, 11:49:28 AM
OK!
Dann probiere ich es jetzt nochmal mit dem Pfad, das was du damals mal gesagt hast!

Kannst du hier vielleicht schnell posten wie ich die Pfade umbauen kann? ...also download in big ...
Und in welcher Datei war nochmal die Stelle?

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: Acidgod on December 17, 2005, 12:36:54 PM
Also Du solltest vielleich dokumentieren was du alles änderst und wo, dann würden solche Fragen sich erübrigen...

Am besten Du installierst dir das mal local auf den Rechner und baust die Mods so lange ein und aus bist Du weiss wo was wann gemacht wird... *g*

Oder wartest noch vielleicht 2 wochen, dann habe ich vielleicht was nettes für dich...  :D
Title: Re: [MOD] Alternate directory for download files.
Post by: Matthias70 on December 17, 2005, 12:49:43 PM
Oder wartest noch vielleicht 2 wochen, dann habe ich vielleicht was nettes für dich...  :D

Hallo Acidgod,
jetzt sag bloß du möchtest daraus ein längst überfälliges Mod bauen :-)

viele Grüße
Matthias
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on December 17, 2005, 01:28:42 PM
Ich kann es gerne mal local auf meinem Rechner auch mal ausprobieren!

Aber wäre wirklich super, wenn du mir in ca. 2 Wochen diesen kompletten Mod fertigstellen könntest!
Auch für Leute, die das später mal ebenfalls benötigen!

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on December 27, 2005, 07:34:23 PM
So, nun habe ich das Problem gelöst!
Es liegt an einer Änderung in der download.php.
Hier musste zustätzlich noch ein Pfad auf den Ordner /big/ geändert werden.

Das einzige Problem, was es jetzt noch gibt ist die Anzeige der Auflösung!
Es wird die Auflösung des Thumbnails angezeigt und nicht die der big-file.
Hier könnt ihr es euch ansehen: http://www.michael-kaps.s-westerhold.de/extras/upload/details.php?image_id=38&sessionid=d8a2a10ab1e8795309c11bdb3d568064

Wie kann man dieses Problem lösen?
An einer Pfadänderung kann es diesmal wohl nicht liegen, sonst würde dort ein "x" für nicht vorhanden stehen.
Ich denke dass es an der Abfrage des Script-Teils liegt...

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: Acidgod on December 27, 2005, 07:40:10 PM

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>

Wofür diese Änderung nur gebraucht wird... *grübel*
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on December 27, 2005, 07:51:39 PM
Ob du es glaubst oder nicht: Das habe ich schon eingebaut!  :mrgreen:
Aber wie du eben unter dem Link sehen kannst, wird nur die Auflösung des Thumbnails angezeigt.

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: Acidgod on December 27, 2005, 08:01:03 PM
Tja dann haste mal wieder was falsch gemacht... )o:
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on December 27, 2005, 08:21:09 PM
Hehe, jo  :D
Dafür bin ich hier im Forum ja schon bekannt.  :?

Aber was könnte ich da falsch gemacht haben?
Also ich habe das in die Details.html genauso eingebaut.

In welcher Stelle des Codes unter folgendem Link hat es was mit der Auflösung zu tun, dann kann ich da nämlich nochmal nachhaken?
http://www.4homepages.de/forum/index.php?topic=7499.msg33712#msg33712

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: Acidgod on December 27, 2005, 08:29:36 PM
Na den anderen Code von Chris haste dann wohl falsch eingebaut... (o:

Überprüfe den einbau noch mal...
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on January 02, 2006, 06:35:52 PM
So, hab alles nochmals gecheckt!
Aber keinen Fehler gefunden!

Soll ich die Datei mal hier reinstellen?

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: troopers on January 08, 2006, 12:53:04 AM
lol, hab genau das gleiche Problem mehr oder weniger. Anfangs gings, jetzt nimmer. nur hab 0 ahnung wo der fehler liegt.
er zeigt mir momentan absolut keine auflösung an, ja hab auch 1000 nachgeguckt worans liegen könnte. was mich nur wundert, ist das er die grösse auslesen tut, aber den rest nicht.
merkwürdig.
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on January 08, 2006, 12:14:42 PM
Juhu, ich bin nicht der einzige!!
Also Acidgod, an was könnte es liegen?
Welcher Teil genau? Ich denke es liegt an einem falschen Pfad, aber an welchem?

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: troopers on January 08, 2006, 07:56:43 PM
bin zwar kein php profi, aber von der logik her, würde ich sagen, würde der pfad nicht stimmen, könnte er auch nicht die dateigröße auslesen. aber wer weiß.....
was mich nur wundert, das das exif davon $download_file_src ausgelesen werden kann, aber die auflösung irgendwie nicht... boah suche schon ewig nach dem fehler -g-

Wenn jemand so lieb wär, und lust / laune und zeit hat, kann ja sich mal gern die beiden (download & functions) von mir mal anschauen.
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on January 09, 2006, 01:35:35 PM
So viel ich weiß, sind die Pfade für die Auflösung und anderen Funktionen alle extras bestimmt.
Ich denke, das ein Pfad auf die normale Thumbnail-Datei führt und man deshalb auf /big/ erweitern muss.
Aber ich weiß nicht, wo der Fehler stecken könnte!

ALSO BITTE HELFEN!!  :?

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: troopers on January 11, 2006, 08:08:10 AM
Also ein Problem hab ich gelöst, das wenigstens in den details die auflösung angezeigt wird (der eintrag war doppelt drin der die hähe und breite ausliest, warum auch immer -g-). allerdings funktioniert das ganze noch nicht auf der home seite.

Wenn jemand Rat weiß, wäre klasse ergreifende Hinweise auf den Fehler zu geben.


Vielen Dank und Gruß
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on January 11, 2006, 02:04:22 PM
Hey cool, vielen Dank für den Tipp!
Kannst du mir sagen, welcher Eintrag doppelt vorhanden ist? Siehe Beitrag von Chriss, welche des ist...
War das in dem Script, oder in der details.html ?

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on January 11, 2006, 04:50:26 PM
So, ich hab das Problem jetzt gelöst.
Es lag an einer falschen Variable in dem Teil, wo du mir per PN geschickt hast!

JUHU, endlich läuft es!  :D

Vielen Dank nochmals für deine Hilfe!

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: troopers on January 11, 2006, 10:40:25 PM
hehe,hab ja nicht viel geholfen :)
aber vll. - nochmal für andere deine var. posten (die geändert hast) - die evtl. später noch das problem haben werden.

Gruß
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on January 12, 2006, 03:58:17 PM
Ich glaube die anderen sind schlauer als ich und übersehen nicht die Varibale "download" gegen evtl. "big" zu tauschen...  :D
Weil das habe ich übersehen!

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: Matthias70 on January 12, 2006, 09:53:20 PM
@wobei ich dir das mehr als einmal in mehreren postings gesagt habe  :roll:
Matthias
Title: Re: [MOD] Alternate directory for download files.
Post by: Fireball22 on January 13, 2006, 02:21:34 PM
Schon, das war aber das Problem mit der big-file-download!!
Das hier war die Auflösung!

Fireball22
Title: Re: [MOD] Alternate directory for download files.
Post by: auris on November 11, 2006, 02:47:27 AM
Chris can u just put here your files from your 4images i just mest up everythinng  :cry: its hard to find that codes... i search for 5 hours everything  8O it would be easier for everyone than edit tags...
Title: Re: [MOD] Alternate directory for download files.
Post by: m.a on November 25, 2006, 08:15:58 AM
So the code will look for your download images in:

category_id/download
category_id

Your download image files must have the same name as the image file used on the details page.  Just upload everything using FTP and the CHECK NEW IMAGES admin CP function.
Quote



Hi,
Prima, und Sehr gut.
Ich habe es instaliert und läuft auch sehr gut.

Aber ich brauche, dass statt Bereite=width und höhe=height von view-Bild, width und height von Original-Bild im big-Ordber zeigen lassen.

Z.B.: Statt Dateigröße: 6.7 MB [550x366] ==> {download_image_file_size} [{download_width}x{download_height}]
 so ausgeben:   Dateigröße: 6.7 MB [4368x2912]
Und das genauso von Exif und Iptc Informatino von Ordner big nicht von View-Bild.

Danke im Voraus
m.a
Title: Re: [MOD] Alternate directory for download files.
Post by: Entropyx on December 02, 2006, 07:45:17 AM
I have a problem,

I'm using V@no's auto image resize mod with this one
but when i go to download the image, it still downloads as the resized image
and i've tried remodding it twice
Title: Re: [MOD] Alternate directory for download files.
Post by: Holli on January 28, 2007, 12:03:54 AM
Hilfe,
jetzt hab ich ich den Wurm drin,
ich hab wie oben im Link beschrieben alles geändert, die org Bilder in das neue Verzeichnis,  cat-id/download verschoben und die Bilder im alten org verzeichnis gelöscht. Nun  werden die alten Bilder beim download richtig gefunden aber wenn ich neue Bilder hochlade und mit Bilder checken einbinde weden die Thumbs beim download angeboten, was hab ich falsch genacht ?

Danke

vG
Holli
Title: Re: [MOD] Alternate directory for download files.
Post by: Holli on January 28, 2007, 10:05:26 PM
Hallo,

Bitte, bitte, helft mir, sonst muß ich wieder umstellen und bei jedem einzelnen Bild den externen downloadlink eintippen :-(

vG
Holli
Title: Re: [MOD] Alternate directory for download files.
Post by: rinaldos on February 19, 2007, 11:28:06 PM
Hallo zusammen,

wenn ich versuche diesen Mod einzubauen meckert er immer an den variablen ("new_limit" => $new_limit,"limit_var" => $limit_var,) von diesem MOD:     
[MOD] Details Ansicht / Größe des Bildes begrenzen (http://www.4homepages.de/forum/index.php?topic=9885.0). entferne ich die beiden Variabeln funktioniert der MOD Alternate Directory, aber der andere MOD nicht mehr.

Wie kann ich denn beide MODS miteinander kombinieren?

-----
Habe um mir kurzfristig zu helfen, einfach unter:

    $site_template->register_vars(array(
      "media_src" => $media_src,
      "media_icon" => $media_icon,
      "image_name" => $image_name,
      "width_height" => $width_height,
      "width" => $width,
      "height" => $height,
      "download_width" => $download_width, // Download file
      "download_height" => $download_height, // Download file
      "iptc_info" => $iptc_info
    ));
--
diesen Block
--
     $site_template->register_vars(array(
      "new_limit" => $new_limit,
      "limit_var" => $limit_var,
      "exif_info" => $exif_info
    ));
--
eingefügt. Damit geht es auf einmal. Ich denke das ist nicht die Musterlösung. Wenn einer der Profis da mal nach schauen könnte?

Erneuter Gruß

Ingo
Title: Re: [MOD] Alternate directory for download files.
Post by: Acidgod on February 20, 2007, 09:29:06 AM
Code: [Select]
    $site_template->register_vars(array(
      "media_src" => $media_src,
      "media_icon" => $media_icon,
      "image_name" => $image_name,
      "width_height" => $width_height,
      "width" => $width,
      "height" => $height,
      "download_width" => $download_width, // Download file
      "download_height" => $download_height, // Download file
      "iptc_info" => $iptc_info,
      "new_limit" => $new_limit,
      "limit_var" => $limit_var,
      "exif_info" => $exif_info
    ));

Funzt das?
Title: Re: [MOD] Alternate directory for download files.
Post by: rinaldos on February 20, 2007, 12:41:01 PM
Hallo,

ich bin gerade etwas ratlos. Als ich gestern genau die Variabeln unter den Block gesetzt hatte (Genau wie du vorgeschlagen hast) bekam ich direkt eine Fehlermeldung und die Webseite wurde nicht mehr angezeigt........
Nun habe ich deinen Vorschlag eingebaut und es funktioniert. Irgendwie komisch :-) Naja, nehmen wir das nun einfach als gegeben hin :-)

Was mir jetzt aufgefallen ist, das er nun über die Suchfunktion eine Fehlermeldung bringt:
----
Notice: Undefined variable: download_width in D:\Website\includes\functions.php on line 608
Notice: Undefined variable: download_height in D:\Website\includes\functions.php on line 609
----
Genau da stehen die Variabeln       
"download_width" => $download_width, // Download file
"download_height" => $download_height, // Download file

aus dem MOD: [MOD] Details Ansicht / Größe des Bildes begrenzen.

Hmmm. Irgendwo habe ich garantiert einen Wurm drinne :-(

LG
Ingo
Title: Re: [MOD] Alternate directory for download files.
Post by: Acidgod on February 20, 2007, 04:44:47 PM
Code: [Select]
   
if (!isset($download_height)) {
$download_height = "";
}
if (!isset($download_width)) {
$download_width = "";
}

 $site_template->register_vars(array(
      "media_src" => $media_src,
      "media_icon" => $media_icon,
      "image_name" => $image_name,
      "width_height" => $width_height,
      "width" => $width,
      "height" => $height,
      "download_width" => $download_width, // Download file
      "download_height" => $download_height, // Download file
      "iptc_info" => $iptc_info,
      "new_limit" => $new_limit,
      "limit_var" => $limit_var,
      "exif_info" => $exif_info
    ));

Teste das mal...
Title: Re: [MOD] Alternate directory for download files.
Post by: rinaldos on February 20, 2007, 08:04:13 PM
Hi Acidgod :-)

Ich danke dir für die schnelle Antwort. Die Lösung hat funktioniert. Der Fehler beim suchen ist nun weg :-) Nun können endlich die User die Bilder in der grösseren Version laden :-)

Dank diesem Forum habe ich schon den ein oder andere Hinweis gefunden und innerhalb kürzester Zeit etwas gelernt. Am Anfang hatte ich noch keinen Plan von PHP, aber so langsam sehe ich einen Zusammenhang in vielen Dingen. Bin leider ein blutiger Anfänger  was das Programmieren angeht.

Danke nochmal für die schnelle Hilfe :-)

Gruß
Ingo
Title: Re: [MOD] Alternate directory for download files.
Post by: osnapicture on February 21, 2007, 04:33:53 PM
also ich komme irgendwie mit diesem Mod nicht klar. Ich würde gerne einfach ohne viel Schnickschnak das Foto aus meinem BigFolder-Ordner gedownloadet bekommen, wenn ich auf den stinknormalen Downloadbutton klicke. Das müsste doch theoretisch durch eine simple Änderung in der download.php möglich sein, indem man dort den Standart-Downloadpfad um "/bigfolder" ergänzt. Oder liege ich da falsch? Ich hoffe, mir kann jemand helfen.
Title: Re: [MOD] Alternate directory for download files.
Post by: osnapicture on May 14, 2007, 10:16:43 AM
any suggestions?
Title: Re: [MOD] Alternate directory for download files.
Post by: nobita on June 25, 2007, 09:27:14 AM
Code: [Select]
  $file_size = "n/a";
  if (!is_remote($image_row['image_media_file'])) {
    if ($file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
      $file_size = format_file_size($file_size);
    }
  }
  elseif ($detailed_view) {
    $file_size = get_remote_file_size($image_row['image_media_file']);
  }

I can find this code in functions.php (I'm using version 1.7.4)
Title: Re: [MOD] Alternate directory for download files.
Post by: urmasmuld on August 08, 2007, 11:32:48 AM
Ill get this error :
Code: [Select]
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/www/htdocs/) is not within the allowed path(s): (/www/02/***:/www/data/***:/tmp) in /www/02/***/album/includes/functions.php on line 547


Line 547 is :
Code: [Select]
$src_download = (!file_exists($download_file_src) && file_exists(preg_replace("/\/{2,}/", "/", get_document_root()."/".$download_file_src))) ? preg_replace
("/\/{2,}/", "/", get_document_root()."/".$download_file_src) : $download_file_src;


How to solve this ?
Title: Re: [MOD] Alternate directory for download files.
Post by: thunderstrike on August 08, 2007, 02:36:39 PM
FAQ
Title: Re: [MOD] Alternate directory for download files.
Post by: urmasmuld on August 09, 2007, 03:15:00 PM
FAQ?
but where :?: Could you be more specific plz... :?
-----------------
I just cant find anything from FAQ forums....is it Safe Mode problem ?
Title: Re: [MOD] Alternate directory for download files.
Post by: thunderstrike on August 09, 2007, 06:07:57 PM
Ok this mean host restrict your site. Must send ticket to host.
Title: Re: [MOD] Alternate directory for download files.
Post by: thunderstrike on September 19, 2007, 11:37:21 PM
Quote
but i can't get good result of this work.
who can help me?

Very short post ... please read my signature for get help in forum (+ Nicky 3 steps signature)
Title: Re: [MOD] Alternate directory for download files.
Post by: kujayhawk on April 22, 2008, 08:29:31 PM
Hi all,

I have somewhat successfully added Chris' "Alternate directory for download files." The problem I am having is that when I click the download button on images that I know there is a matching filename within the 'big' folder, the resized image still downloads. It shows the correct filesize for the big file too. I have looked through all the pages in that forum thread and can not find the solution. Any help would be great as I am sure it is some small change I am not catching.

Thanks!
Title: Re: [MOD] Alternate directory for download files.
Post by: mawenzi on April 22, 2008, 08:32:03 PM
... but without URL ...  :roll:
Title: Re: [MOD] Alternate directory for download files.
Post by: kujayhawk on April 22, 2008, 08:35:51 PM
Woops, sorry.

http://www.4homepages.de/forum/index.php?topic=7499.0 is the topic and about 4 or 5 posts down is Chris' code in reply to the original message.
Title: Re: [MOD] Alternate directory for download files.
Post by: mawenzi on April 22, 2008, 09:08:19 PM
... not the thread url ... I know Chris' code for alternate directory for download files ....
... your website url ... !
... where can I see your problems with the mod .... ?
Title: Re: [MOD] Alternate directory for download files.
Post by: kujayhawk on April 22, 2008, 09:41:31 PM
Right, ha. That would be photographybyweston.com/ku. The folder with the big images is under tennis, iowa state, iowa state player. That is the only folder on the server with big images along with regular images.

Every other category on the site has just regular resized images with no big folder.

I am not getting any errors at all while downloading without changes to Chris' code, it just downloads the regularly sized file. What would be the ultimate is on the details page, knowing how to get a link or make a button to where if there is a big file associated with the resized version to have that display in addition to the regular download size.

Below this is the code I noticed in download.php, I changed the last ending '/' to be '/big/' and it downloaded the big files in that Iowa State Player folder, but on a regular image without the BIG size it did not download properly. Hope all this information helps, and I really appreciate you giving me a hand with this!

Thanks,
Weston

Code: [Select]
//    $file['file_path'] = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".$file['file_name'];
    // 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);
if( !file_exists($temp) )
  $temp = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".$file['file_name'];
$file['file_path'] = $temp;
  }
Title: Re: [MOD] Alternate directory for download files.
Post by: nobby on April 22, 2008, 09:58:31 PM
Hi,

The 4images Copyright is not available.
I assume that you have been licensed.

http://www.4homepages.de/4images/license.php#english
Title: Re: [MOD] Alternate directory for download files.
Post by: mawenzi on April 22, 2008, 10:06:04 PM
... nobby is right ...  :roll:
Title: Re: [MOD] Alternate directory for download files.
Post by: kujayhawk on April 22, 2008, 10:08:04 PM
there is the 4images link thing at the bottom still. what exactly is supposed to be there?
Title: Re: [MOD] Alternate directory for download files.
Post by: mawenzi on April 22, 2008, 10:20:38 PM
... the 4images-link is there since 3 minutes ...  :mrgreen:
... the downloadlink in /Women's Tennis/ works only for registered users ...
... please change the permission for testing ...
Title: Re: [MOD] Alternate directory for download files.
Post by: kujayhawk on April 22, 2008, 10:25:50 PM
ok, the permissions are correct now.
Title: Re: [MOD] Alternate directory for download files.
Post by: mawenzi on April 22, 2008, 10:44:21 PM
ok, the permissions are correct now.

... no ... not right ...
... you must also change the permissions for at least one subcategory ...  :roll:

hey kujayhawk,
- this is my 5. post only with questions to see how your donload-link work ...  :roll:
- and now I can't still see the download link ...  :roll:
Title: Re: [MOD] Alternate directory for download files.
Post by: kujayhawk on April 23, 2008, 01:10:33 AM
Yes, I realize that, I am sorry.

I am logged out of a user account and looking at the category and it shows me the download link for the photo.
http://photographybyweston.com/ku/categories.php?cat_id=89 is the tennis category, cat_id=90 is the big images category.

Maybe your browser cache has not been updated?

I really appreciate you taking the time on this.
Title: Re: [MOD] Alternate directory for download files.
Post by: kujayhawk on April 24, 2008, 07:55:08 AM
Any luck?
Title: Re: [MOD] Alternate directory for download files.
Post by: mawenzi on April 24, 2008, 01:19:49 PM
... I 'm a little bit confused ...
... in cat 89 you don't have any big-images in /data/media/89/big ....
... in cat 90 your big images are in /data/media/90 and in /data/media/90/big are also no big-images ...
...  :roll: ...
... I think, first of all you should study this ...
... a answer of your "three images request" ... here is my tutorial [TUT] One Image - Three sizes (http://www.4homepages.de/forum/index.php?topic=20496.0)  ...
Title: Re: [MOD] Alternate directory for download files.
Post by: kujayhawk on April 24, 2008, 03:36:33 PM
... I 'm a little bit confused ...
... in cat 89 you don't have any big-images in /data/media/89/big ....
... in cat 90 your big images are in /data/media/90 and in /data/media/90/big are also no big-images ...
...  :roll: ...
... I think, first of all you should study this ...
... a answer of your "three images request" ... here is my tutorial [TUT] One Image - Three sizes (http://www.4homepages.de/forum/index.php?topic=20496.0)  ...


Well, it is not three images. It is only two. Category 89 should not have big images, I did not want to keep the big versions of those. Only the different player from Iowa State Player folder did I want to keep the originals. So its 89/90/big, where 89 are the KU photos, 90 are the Iowa State Player photos, and 90/big are the Iowa State Player big photos.

There is definitely a 90/big folder on the server though, and it does have the big images in it.
Title: Re: [MOD] Alternate directory for download files.
Post by: Gostemilov on May 21, 2008, 10:25:41 AM
7 pages of discussions... And no result.

Can anybody uload 2 files (download.php and functions.php), i.e. ready decision?

I've tried lot of above,but it still doesn't works.

Thanks a lot.
Title: Re: [MOD] Alternate directory for download files.
Post by: mawenzi on May 21, 2008, 02:54:47 PM
Can anybody uload 2 files (download.php and functions.php), i.e. ready decision?

... and what about all the other modifications ...  :?
... this is not the way of a modification of download.php and functions.php ...

... b.t.w. ... Chis modification works in the best way ...
... http://www.4homepages.de/forum/index.php?topic=7499.msg33712#msg33712 ...
Title: Re: [MOD] Alternate directory for download files.
Post by: Gostemilov on May 21, 2008, 08:49:46 PM
Strange way. "Modify download.php and Functions.php"

I asked for these ready-to-use files....
Title: Re: [MOD] Alternate directory for download files.
Post by: mawenzi on May 22, 2008, 01:08:25 AM
... then feel free to wait, that some one post these files ... ;)
Title: Re: [MOD] Alternate directory for download files.
Post by: budduke on May 23, 2008, 08:25:54 PM
I have looked around and have not found an answer to a problem that I am running into...
Everything works fine is a user logs in and uploads a file, if it is big then it makes the big folder and makes a copy there and auto resizes to the size I need for the detail page and the download button gives them the original file from the download button.

but if I log into the admin main control panel I can not have the same thing happen?
I bring my photos in batches using batch import plugin, one solution would be to have that plugin make a copy of the file in a big directory at the same time but I could not understand the code enough to do it myself.

the other option is that I use the auto-image-resizer in that admin settings panel. when I use it, it does nothing for this big folder, it just resizes the images. I guess this would be the best place for the fix because it would determine if the file was bigger then my set size, if it was then make a copy of the file to the big folder before resizing it. but it does not do that.

I have installed/reinstalled the mods over and over and can not get anywhere? Does anyone have any paths I should try?
I am using the latest 1.7.6 if that helps

thanks for a great product!

UPDATE
The way I got it to work did OK but the problem has already been addressed..
http://www.4homepages.de/forum/index.php?topic=6978.0

I was using the original resizer mod and not the 2.1 version of it....
Title: Re: [MOD] Alternate directory for download files.
Post by: Gostemilov on May 25, 2008, 08:45:08 PM
Quote
then feel free to wait, that some one post these files

Of course, I'm feel free to wait. And, of course, I made all necessary changes long time ago. But there is a small question... What are You doing here, Mr. Moderator? Usually, Moderators helps people (don't care, it'not about You, of course!)  :D
Title: Re: [MOD] Alternate directory for download files.
Post by: Nicky on May 25, 2008, 09:03:14 PM
[offtopic]
hmmmm...

Moderator is not a helper.
moderator is the guy who moderate/watch/move/edit/delete users sarcastics posts ;)
Title: Re: [MOD] Alternate directory for download files.
Post by: Gostemilov on May 26, 2008, 08:21:55 AM
Quote
Moderator is not a helper.
- really?

I think it's the first forum on the Net there Moderator is just Watcher.
Title: Re: [MOD] Alternate directory for download files.
Post by: Nicky on May 26, 2008, 11:27:30 AM
not always.. ;)

but sometimes...

our moderator mawenzi is a helper... but sometimes you have to wait for the answer like he wrote..

btw.. your problem description is not usefull
Quote
I've tried lot of above,but it still doesn't works.
Title: Re: [MOD] Alternate directory for download files.
Post by: mawenzi on May 28, 2008, 12:37:43 AM
@Gostemilov

1. it is not my MOD, please contakt Chris for the file download ...
2. I have not these files, where only this MOD is integrated ...
3. as I said ... http://www.4homepages.de/forum/index.php?topic=7499.msg117713#msg117713 ...
Title: Re: [MOD] Alternate directory for download files.
Post by: SunnyUK on June 22, 2008, 02:29:52 AM
I've struggled with this MOD for some hours now. There is something wrong with downloads from the \big directory (and yes, I have read all 8 pages in detail and been over the code several times). But the good news is that the mod works (at least for me) if the big files are stored in \download.

So an easy way around it is to update admin\checkimages.php and make "download" the default directory for oversized images:
Code: [Select]
$big_folder_default = "download"; //name of the "big" folder where original image will be copied to, if its bigger then size set in the settings.
Just thought this might help some of the other people who have struggled with the download still being of the reduced size even when there is a bigger file they'd like to download.
Title: Re: [MOD] Alternate directory for download files.
Post by: SunnyUK on June 22, 2008, 11:12:06 PM
Firstly, thanks a bunch for this great mod. It's great functionality!

When an image is deleted, both the image and the thumbnail gets deleted. However, the "big" or "download" version does not automatically get deleted at the same time.

Any idea about how to fix that?

Thanks in advance
Title: Re: [MOD] Alternate directory for download files.
Post by: SunnyUK on June 24, 2008, 12:07:32 PM
Just in case anyone else would like to be able to also delete the "big" files, here's the solution I came up with after seeing that this issue hadn't been tackled by anyone else before.

In lang\english\admin.php search for
Code: [Select]
$lang['thumb_delete_success'] = "Thumbnail file deleted";
$lang['thumb_delete_error'] = "Error deleting thumbnail file";

Insert this after:
Code: [Select]
$lang['bigimage_delete_success'] = "Big image file deleted";
$lang['bigimage_delete_error'] = "Error deleting big image file";

Do the same in \lang\deutch\admin.php

in admin\images.php search for
Code: [Select]
      if (!empty($image_row['image_thumb_file']) && !is_remote($image_row['image_thumb_file']) && !is_local_file($image_row['image_thumb_file'])) {
        if (@unlink(THUMB_PATH."/".$image_row['cat_id']."/".$image_row['image_thumb_file'])) {
          echo "&nbsp;&nbsp;".$lang['thumb_delete_success']." (".$image_row['image_thumb_file'].")<br />\n";
        }
        else {
          $error_log[] = "<b>".$lang['thumb_delete_error']." (".$image_row['image_thumb_file'].")<br />\n";
        }
      }

(this is within a function called delete_images)

After that code, insert
Code: [Select]
/* We should also delete the "big" version in folder /download */
      if (!is_remote($image_row['image_media_file']) && !is_local_file($image_row['image_media_file'])) {
        $download_del = MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file'];
if (file_exists($download_del)) {

          if (@unlink($download_del)) {
            echo "&nbsp;&nbsp;".$lang['bigimage_delete_success']." (".$image_row['image_media_file'].")<br />\n";
          }
          else {
            $error_log[] = "<b>".$lang['bigimage_delete_error']." (".$download_del.")<br />";
          }
}
      }

If your "big" folder is not called \download, then you need to replace the /download/ with your "big folder"-name in this line of my code:
Code: [Select]
        $download_del = MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file'];
Title: Re: [MOD] Alternate directory for download files.
Post by: FunnyUser on February 27, 2009, 11:38:53 AM
I know it sound crazy but how can I change generally the download-dir.

I need the download dir for ALL images like this:
http://www.MY-EXTERNAL-SERVER.com/downloads/{image_name}.jpg

Please don't worry! I perfectly know what I'm doing (all images are named to let this work).

But I don't want to link the thumbnail, or the image to that URL because than the script will not count how often each image was downloaded.


Can someone please help me!?


Thanks a lot!
Title: Re: [MOD] Alternate directory for download files.
Post by: Sam1 on March 05, 2009, 04:09:02 AM
Ok, this is the mod I was looking for, but after I did the mod I don't see the player anywhere in the gallery.  Is there something in the acp that needs to be turned on?  I looked therere but don't see anything to activate the player.
Title: Re: [MOD] Alternate directory for download files.
Post by: CarstenM on April 15, 2009, 10:19:20 AM
was genau macht der mod??
Title: Re: [MOD] Alternate directory for download files.
Post by: Rembrandt on April 15, 2009, 05:30:35 PM
Hi!
was genau macht der mod??
du nix lesen?
so.. wenn du ein großes bild z.b. 2000px x 3000px hochladest, und anschliessend in ACP es validierst wird ein thumbnail erstellt, ein verkleinertes z.b. 800px x600px
auf der detailseite siehst du das 800 x 600 bild, und kannst es dort downloaden, in der detailbeschreibung siehst du wie groß das originalbild ist,
 und wenn du es in die lightbox verschiebst, kannst du von dort aus das original 2000px 3000px downloaden.

mfg Andi
Title: Re: [MOD] Alternate directory for download files.
Post by: CarstenM on April 16, 2009, 11:57:53 AM
d.h. ich lade bilder per ftp auf den Server und dann check ich sie ein und dann macht der direkt die Thumbnail und das Detailbild???
Title: Re: [MOD] Alternate directory for download files.
Post by: Rembrandt on April 16, 2009, 06:00:42 PM
Hi!
d.h. ich lade bilder per ftp auf den Server und dann check ich sie ein und dann macht der direkt die Thumbnail und das Detailbild???
ja wie oft den noch.
vorraussetzung ist, du hast einen vernünftigen provider, bei funpic z.b. funktioniert das nur sehr eingeschränkt, das die zuwenig speicher zur verfügung stellen.

Title: Re: [MOD] Alternate directory for download files.
Post by: CarstenM on April 18, 2009, 07:28:19 PM
also anscheinend bin ich zublöd dafür....

ich lade die Bilder hoch per ftp.... und dann was mach ich dann?  geh ich auf Bilder einschecken und dann??

? erstelle ich Thumbnail manuell
? und dann autoimage resize?

Title: Re: [MOD] Alternate directory for download files.
Post by: Rembrandt on April 18, 2009, 08:38:55 PM
also anscheinend bin ich zublöd dafür....

ich lade die Bilder hoch per ftp.... und dann was mach ich dann?  geh ich auf Bilder einschecken und dann??

? erstelle ich Thumbnail manuell
? und dann autoimage resize?
jaaaa... du gehst auf neue bilder checken stellt dort alles ein und der rest geht automatisch, dazu brauchst du vanos checkimages.php von hier aus dem forum.

mfg Andi
Title: Re: [MOD] Alternate directory for download files.
Post by: CarstenM on April 18, 2009, 11:03:00 PM
müsst man halt dabei schreiben das man die bracuht....

wo finde ich diese den?
Title: Re: [MOD] Alternate directory for download files.
Post by: dp on October 07, 2009, 04:57:30 PM
Hi,

just tested with v1. 7. 7 on Mobile Server.  Worked without any Problem.

Thank you very much for sharing this!
Title: Re: [MOD] Alternate directory for download files.
Post by: dp on October 09, 2009, 05:03:35 PM
Hi,

I'm trying to expand this mods functionality to have more than one download-directory (with different picture-sizes therein) and let the user choose via selction-formular which size to download on the details-page.    

My approach seemed quiet simple to me: just use a variable instead of the phrase "/download" where the download-path is defined and assign the name of the choosen download-directory to this variable via the formular.    
Unfortunately this failed because I could not succeed to declare the variable as global, so that it is accessible from other parts of the script.     So the main question for me is at the moment: How can I define a variable as global and accessible for the whole script?

I asked this Question in another thread 4homepages.  de/forum/index.  php?topic=26033.  0  and V@no thankfully gave me some answers, but at least I couldn't solve the problem so I follow the advice to post the problem here and give more details.  
As you see, I'm just a beginner in php but very experienced in other scripts like vb and in html and css, too.    

Here is what I did:
in includes/funktions.    php I modified the original mod


    $check_handle = "check_".    $image_type.    "_type";
//-----------------------------------------------
//-- MOD Alternative Download Directory ---------
//    $path = (($image_type == "media") ? (($cat_id) ? MEDIA_PATH.    "/".    $cat_id : MEDIA_TEMP_PATH) : (($cat_id) ? THUMB_PATH.    "/".    $cat_id : THUMB_TEMP_PATH)).    "/".    $file_name;
//    return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH.    "/".    get_file_extension($file_name).    ".    gif" : $path) : $return_code;
// Download file block insert BEGIN
    switch( $image_type ) {
 case "media":
   if( $cat_id )
     $path = MEDIA_PATH.    "/".    $cat_id;
else
 $path = MEDIA_TEMP_PATH;
   break;
      case "big":
        $path = MEDIA_PATH.    "/".    $cat_id.    "/big";
   break;
      case "download":
        $path = MEDIA_PATH.    "/".    $cat_id.    "/download";
        echo $path;                                  
        break;
 default:
   if( $cat_id )
     $path = THUMB_PATH.    "/".    $cat_id;
else
 $path = THUMB_TEMP_PATH;
   break;
}
$path .    = "/".    $file_name;
// Download file block insert END
    return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH.    "/".    get_file_extension($file_name).    ".    gif" : $path) : (($image_type != "big" && $image_type != "download") ? $return_code : ""); // Download file :: V@no big mod


to


        $path = MEDIA_PATH.    "/".    $cat_id.   $dp_download_folder;     // changing the original phrase "/download" to a varibale


where $dp_download_folder is the variable for the download-directory and should contain e.    g.     "/download" or any other directory with different size of the picture.    
This Variable I declared as global at top of the function:


function get_file_path($file_name = "", $image_type = "media", $cat_id = 0, $in_admin = 0, $return_icon = 1, $check_remote = CHECK_REMOTE_FILES) {
    global $dp_download_folder;


When I assign $dp_download_folder = "/med", e.    g.     at the top of global.    php, the download-button at the details-page will succesfully download from this directory.    

I now set up a form in details.    html of my template wich should choose the picture-size and set $dp_download_folder

Code: [Select]
(.  .  .  )
<?php
if (isset( $_POST['dp_picsize'] ))
{
$dp_download_folder $_POST['dp_picsize'];
}
?>

<!-- download_folder_form -->
<div id="dp_select_download">
  <form id="select_download_folder" method="post" name="dp_download_directory" action="<?php echo $_SERVER['PHP_SELF']; ?>?image_id={image_id}">
    <select name="dp_picsize" onchange="if (this.  options[this.  selectedIndex].  value != 0){ forms['jumpbox'].  submit() }" class="dp_picsize_select">
      <option value="/med">Bildgröße wählen</option>
      <option value="/med">----------------</option>
      <option value="/med">800 Pixel</option>
      <option value="/download">Originalgröße</option>
    </select>
    <input type="image" src="{template_url}/images/hintergrund_submit_suche.  gif" name="dp_download" id="submitbutton" />
  </form>
</div>
<!-- END download_folder_form -->
(.  .  .  )

Selecting "800 Pixel" in the form will set $dp_download_folder to "/med" (I checked this with echo $dp_download_folder), but this variable is still local and not identical with global $dp_download_folder, wich still has no value.

[EDIT by V@no]
I didn't change anything, just hit save button. For some reason the forum doesn't display properly php code until I save it...
Title: Re: [MOD] Alternate directory for download files.
Post by: honda2000 on February 02, 2010, 04:31:12 PM
Hat jemenad dem MOD für 1.7.7 zusammenhängen, funtionierend??
Title: Re: [MOD] Alternate directory for download files.
Post by: viadata on February 14, 2010, 06:47:24 PM
Hallo Zusammen,

ich habe den MOD eingebaut. Kann nun die "big" Bilder aus dem Big Verzeichnis laden.

3 Probleme:

- Die Bildauflösung zeigt nun die Werte des Bildes der Detail Ansicht, wärend die Dateigröße vom Big Bild angezeigt wird.
- Das Big Bild wird in einem neuen Browserfenster geladen, ich wollte das als Download
- Über den Leuchtkasten geht der Download nicht. Es wird nur ein neues weißes Browserfenster angezeigt.

Hat jemand einen Tip, wo ich suchen muss?

Danke

Holger
Title: Re: [MOD] Alternate directory for download files.
Post by: ***elvis*** on April 16, 2010, 06:58:36 PM
...
- Das Big Bild wird in einem neuen Browserfenster geladen, ich wollte das als Download
- Über den Leuchtkasten geht der Download nicht. Es wird nur ein neues weißes Browserfenster angezeigt....

Das wäre natürlich nicht so gut. Mir geht es auch ausschließlich darum das so hinzubekommen, das bei klick auf Download-Button / Zip oder  Leuchtkasten immer die Datei aus dem Bigfile Ordner genommen wird.

DANKE
Title: Re: [MOD] Alternate directory for download files.
Post by: ***elvis*** on April 18, 2010, 01:19:25 PM
Ich hab mir die Nacht um die Ohren geschlagen ...

EDIT

Gelöst, jetzt läuft es DANKE
Title: Re: [MOD] Alternate directory for download files.
Post by: dp on June 08, 2010, 04:39:19 PM
Ich hab mir die Nacht um die Ohren geschlagen ...

EDIT

Gelöst, jetzt läuft es DANKE

Hallo elvis,

ich fände es schön, wenn du die Lösung ebenfalls hier posten könntest, Danke!
Title: Re: [MOD] Alternate directory for download files.
Post by: ***elvis*** on June 08, 2010, 05:15:05 PM
Quote
Hallo elvis, ich fände es schön, wenn du die Lösung ebenfalls hier posten könntest, Danke!

Ist zwar schon ne weile her wo ich das gemacht habe, bzw. seit dem habe ich so viele Änderungen vorgenommen, aber ich meine ich hab nur ein Fehler beim einbau des MOD´s gemacht.
Title: Re: [MOD] Alternate directory for download files.
Post by: Rembrandt on June 26, 2010, 04:01:59 PM
Code Update, This Mod is Supported by 4images V1.7.8 and Higher
For older 4images Version e.g. 1.7.7  supported by @V@nos checkimages: [MOD] Check new images in ALL categories v2.11 (updated 22-04-2006) (http://www.4homepages.de/forum/index.php?topic=4754.msg19991#msg19991)

the Alternative folder you can either "download" or "big" call.
in the details.html can you see the original size and original resolution.
add in the Lightbox, you can download the original files.


1.) search in includes/functions.php:

  $path = (($image_type == "media") ? (($cat_id) ? MEDIA_PATH."/".$cat_id : MEDIA_TEMP_PATH) : (($cat_id) ? THUMB_PATH."/".$cat_id : THUMB_TEMP_PATH))."/".$file_name;
  return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#\.(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $path) : $return_code;

and replace:

//$path = (($image_type == "media") ? (($cat_id) ? MEDIA_PATH."/".$cat_id : MEDIA_TEMP_PATH) : (($cat_id) ? THUMB_PATH."/".$cat_id : THUMB_TEMP_PATH))."/".$file_name;
  //return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#\.(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $path) : $return_code;
//####################################### Alternate Download Start ##################################################
  switch($image_type){
    case "media":
      if($cat_id)
        $path = MEDIA_PATH."/".$cat_id;
      else
        $path = MEDIA_TEMP_PATH;
        break;
    case "big":
      $path = MEDIA_PATH."/".$cat_id."/big";
      break;
    case "download":
      $path = MEDIA_PATH."/".$cat_id."/download";
      break;
    default:
      if( $cat_id )
        $path = THUMB_PATH."/".$cat_id;
        else
        $path = THUMB_TEMP_PATH;
        break;
  }
  $path .= "/".$file_name;
  return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $path) : (($image_type != "big" && $image_type != "download") ? $return_code : ""); // Download file :: V@no big mod
//####################################### Alternate Download END ####################################################

1.2) search:

if (!is_remote($image_row['image_media_file'])) {
    if ($file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
      $file_size = format_file_size($file_size);
    }
  }

and replace:

/* if (!is_remote($image_row['image_media_file'])) {
    if ($file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
      $file_size = format_file_size($file_size);
    }
  } */
//####################################### Alternate Download Start ##################################################
  $download_file_size = "n/a";  // Download file

  if (!is_remote($image_row['image_media_file'])) {
    if ($file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
      $download_file_size = $file_size;
      $file_size = format_file_size($file_size);
    }
    if( file_exists(MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file'])){
      $download_file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file']);
    }  
    elseif( file_exists(MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file']))
        $download_file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file']);
        $download_file_size = format_file_size($download_file_size);
  }
  //####################################### Alternate Download END ####################################################

1.3) search:

"url_download" => $site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id']),

insert below:

//############################################ Alternate Download Start ########################################
    "download_image_file_size" => $download_file_size,
    "lang_original_size" => $lang['original_size'],
    "lang_original_resolution" => $lang['original_resolution'],
//############################################ Alternate Download END ##########################################

1.4) search:

$height = $image_info[1];

insert below:

//############################################### Alternate Download Start #####################################
        $download_width_height = $width_height;
        $download_width = $width;
        $download_height = $height;
      }
      $big_file = MEDIA_PATH.(($cat_id != 0) ? "/".$cat_id : "")."/"."big"."/".$media_file_name;
      $download_file = MEDIA_PATH.(($cat_id != 0) ? "/".$cat_id : "")."/"."download"."/".$media_file_name;
      if (file_exists($big_file)){
        $bild = $big_file;
      }
      elseif (file_exists($download_file)){
        $bild = $download_file;
      }
      else{
        $bild = $src;
      }
      if (in_array(strtolower($file_extension), array('gif','jpg','jpeg','png','swf')) && $image_info = @getimagesize($bild, $info)) {
//############################################### Alternate Download End #######################################

1.5) search:

$site_template->register_vars(array(
      "media_src" => $media_src,
      "media_icon" => $media_icon,
      "image_name" => format_text($image_name, 2),
      "width_height" => $width_height,
      "width" => $width,
      "height" => $height,
      "iptc_info" => $iptc_info,
      "exif_info" => $exif_info
    ));

and replace:

//###################################### Alternate Download Start ##############################################  
      //$download_file_src = get_file_path($media_file_name, "download", $cat_id, 0, 1);
      $src_download = (!file_exists($bild) && file_exists(preg_replace("/\/{2,}/", "/", get_document_root()."/".$bild))) ? preg_replace("/\/{2,}/", "/", get_document_root()."/".$bild) : $bild;
      if ($temp = @getimagesize($src_download, $bild)) {
        $download_width_height = " ".$temp[3];
        $download_width = (isset($temp[0]))? $temp[0]:"";
        $download_height = $temp[1];
      }
//####################################### Alternate Download END ###############################################
    $site_template->register_vars(array(
      "media_src" => $media_src,
      "media_icon" => $media_icon,
      "image_name" => format_text($image_name, 2),
      "width_height" => $width_height,
      "width" => $width,
      "height" => $height,
//###################################### Alternate Download Start ##############################################      
      "download_width" => $download_width,
      "download_height" => $download_height,
//###################################### Alternate Download END ################################################      
      "iptc_info" => $iptc_info,
      "exif_info" => $exif_info
    ));

1.6) search:

?>

insert above:

//###################################### Alternate Download Start ############################################
function check_remote_download($remote_media_file) {
  global $config;
  return (preg_match("#^(https?:\/\/[a-z0-9\-]+?\.([a-z0-9\-]+\.)*[a-z]+(:[0-9]+)*\/.*?\.(".$config['allowed_mediatypes_match'].")$)#is", $remote_media_file)) ? 1 : 0;
}
function check_local_download($local_media_file) {
  global $config;
  return (preg_match("#^((\.)*\/.*?\.(".$config['allowed_mediatypes_match'].")$)#is", $local_media_file)) ? 1 : 0;
}
function check_download_type($file_name) {
  global $config;
  return (in_array(get_file_extension($file_name), $config['allowed_mediatypes_array'])) ? 1 : 0;
}
//###################################### Alternate Download End ###############################################


2.) search in root/download.php:

$file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
 
and replace:

//  $file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
//###################################### Alternate Download Start ##############################################
  $file_path = MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file'];
  if(!file_exists($file_path)){
    $file_path = MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file'];
  }
  if(!file_exists($file_path)){
    $file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
  }
//###################################### Alternate Download End ##############################################
 
2.1.) search:

$file['file_path'] = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".$file['file_name'];
 
and replace:

//  $file['file_path'] = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".$file['file_name'];
//########################################## Alternate Download Start ##############################################    
  $media_file_download = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/download/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/download/".$file['file_name'];
  $media_file_big = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/big/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/big/".$file['file_name'];
  $media_file = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".$file['file_name'];

  if (file_exists($media_file_download)){
    $file['file_path'] = $media_file_download;
  }
  elseif(file_exists($media_file_big)){
    $file['file_path'] = $media_file_big;
  }
  elseif(file_exists($media_file)){
    $file['file_path'] = $media_file;
  }
//########################################### Alternate Download End ##############################################    
 

3.) search in lang/english/main.php:

?>
 
insert above:

//-----------------------------------------------------
//--- Alternate Download ------------------------------
//-----------------------------------------------------
$lang['original_size'] = "Originalsize:";
$lang['original_resolution'] = "Originalresolution:";
 
for lang/deutsch/main.php:

//-----------------------------------------------------
//--- Alternate Download ------------------------------
//-----------------------------------------------------
$lang['original_size'] = "Originalgröße:";
$lang['original_resolution'] = "Originalauflösung:";


4.) search in your/templates/details.html:
Code: [Select]
                         <tr>
                            <td valign="top" class="row1"><b>{lang_file_size}</b></td>
                            <td valign="top" class="row1">{image_file_size}</td>
                          </tr>
insert below:
Code: [Select]

                          <tr>
                            <td valign="top" class="row1"><b>{lang_original_size}</b></td>
                            <td valign="top" class="row1">{download_image_file_size}</td>
                          </tr>                        
                          <tr>
                            <td valign="top" class="row1"><b>{lang_original_resolution}</b></td>
                            <td valign="top" class="row1">{download_width}&nbsp;x&nbsp;{download_height}&nbsp;Pixel</td>
                          </tr>

Option 1.) Show original image in new window by clicking on image

search in the code (step 1.4)
 if (in_array(strtolower($file_extension), array('gif','jpg','jpeg','png','swf')) && $image_info = @getimagesize($bild, $info)) {
insert above:
$site_template->register_vars("show_big", $bild);

search in the code (step 1.5)
"download_width" => $download_width,
      "download_height" => $download_height,

insert below:
"big_width" => $download_width+36,
       "big_height" => $download_height+36,




search in your Templates/details.html:
Code: [Select]
{image}and replace:
Code: [Select]
<a href ="{show_big}" onclick="void(window.open(this.href,this.target,'top=100,left=200,width={big_width},height={big_height},toolbar=no, directories=no, resizable=yes,menubar=no,locationbar=no,scrollbars=auto'));return false;">{image}</a>

now you can by clicking on image show original image in new window.

mfg Andi
Title: Re: [MOD] Alternate directory for download files.
Post by: 1001Musik on February 24, 2011, 06:08:39 PM
Hallo,
ich habe die ganzen Dateien abgeändert wie von Rembrandt beschrieben (danke dafür) ohne Option 1.  Ich möchte die Original Datei nur zum Download haben. Angezeigt soll diese nicht. Ich hoffe das geht mit diesem Mod?

Habe dann ein paar Bilder per ftp in einen Kategorie Ordner geladen. Dann auf Nach neuen Bildern checken und abgewartet. Als alles fertig war, werden mir im Frontend immer noch die kleinen Bilder (also nicht Original) als Download angeboten. Habe ich etwas vergessen oder falsch gemacht. Müssen die Bilder ev. in einen speziellen Ordner?

Würde mich freuen, wenn mir jemand weiter helfen würde.
Title: Re: [MOD] Alternate directory for download files.
Post by: Rembrandt on February 24, 2011, 06:18:49 PM
.... Dann auf Nach neuen Bildern checken und abgewartet. ....
nach dem du bei "Neue Bilder Checken" auf den button "neue bilder checken" geklickt hast, mußt du:
Automatisch verkleinern:    Ein
Originalbild speichern: Ja
einstellen, dann wird dein Großes Originalbild in den ordner "big" verschoben von wo es dann mittels diesen mod herruntergeladen werden kann.

mfg Andi
Title: Re: [MOD] Alternate directory for download files.
Post by: 1001Musik on February 25, 2011, 03:54:23 PM
Danke Dir, nun funktioniert es.
Title: Re: [MOD] Alternate directory for download files.
Post by: heffernan on April 09, 2011, 12:00:34 PM
habe ich gemacht bis zu dem Punkt wo steht:

Code: [Select]
Option 1.) Show original image in new window by clicking on image

search in the code (step 1.4)
PHP Code:  [Select]  [Expand]  [Hide line numbers]

In welcher Datei denn ????

Ich muss doch nur diese Anleitung durchgehen oder muss ich da noch andere Mods oder sonstwa sinstallieren?

Gibt es das nicht als fertiges Plugin???
Title: Re: [MOD] Alternate directory for download files.
Post by: heffernan on April 09, 2011, 12:13:46 PM
Geht das auch wenn ich über admin panel ein bild hochlade? ich will auch "nur" den downlaod anbieten und sonst nur thumbnail und eine 500px größe
Title: Re: [MOD] Alternate directory for download files.
Post by: Rembrandt on April 09, 2011, 01:48:06 PM
habe ich gemacht bis zu dem Punkt wo steht:

Code: [Select]
Option 1.) Show original image in new window by clicking on image

search in the code (step 1.4)
PHP Code:  [Select]  [Expand]  [Hide line numbers]

In welcher Datei denn ????...
steht doch dort "search in the code (step 1.4)"
und nein das geht nur über die checkimages.
und noch etwas, du solltest dir eine neue tastatur zulegen dein "?"  scheint zu hängen.  :?
Title: Re: [MOD] Alternate directory for download files.
Post by: heffernan on April 09, 2011, 01:55:04 PM
Ja stimmt das ? hängt ... ich bin halt so ungeduldig  :D

Dann muss ich immer nur per FTP Bilder raufladen? (nur eins)
Title: Re: [MOD] Alternate directory for download files.
Post by: Rembrandt on April 09, 2011, 01:57:40 PM
..Dann muss ich immer nur per FTP Bilder raufladen? (nur eins)
per FTP kannst du mehr als ein bild hochladen.
Title: Re: [MOD] Alternate directory for download files.
Post by: dosser on July 18, 2011, 12:17:01 AM
1)
Gibt es eine Möglichkeit, dass die Option "Original Bild speichern" automatisch immer auf "JA" eingestellt bleibt ?

2)

Für die Option 1.) Show original image in new window by clicking on image gibt es den Ausdruck
Quote
if (in_array(strtolower($file_extension), array('gif','jpg','jpeg','png','swf')) && $image_info = @getimagesize($bild, $info)) {

2x.

Muss man(n) da bei beiden den angegeben Code einfügen ??



Ansonsten: Great Job !!! Thank You  :D


greetings from Vienna
Title: Re: [MOD] Alternate directory for download files.
Post by: Rembrandt on July 18, 2011, 05:00:40 AM
Hi!

na, Bitte :)

zu 1.) schau ganz oben in der admin/checkimages.php:
$big_default = 0; //save original image (0 or 1)
dort kannst du auf "1" einstellen.

zu 2.) lies bitte genau, da steht:
Quote
search in the code (step 1.4)
damit meine ich eigentlich in dieser Modifikation den schritt 1.4)
und in den code step 1.4) gib es die zeile nur einmal.

mfg Andi
Title: Re: [MOD] Alternate directory for download files.
Post by: madynmalfi on September 15, 2012, 09:42:22 PM
i did exactly what's written  in the codes and i did everything 100% correct BUT my images still showing very ,, i want the images to show small but when they download they download it big ""NOTE:i am using multi download mod""

thanks
Title: Re: [MOD] Alternate directory for download files.
Post by: Rembrandt on September 15, 2012, 10:06:23 PM

... ""NOTE:i am using multi download mod""
...
and what for one?  :?
Title: Re: [MOD] Alternate directory for download files.
Post by: madynmalfi on September 15, 2012, 11:14:01 PM
sorry , but what you mean by what for one ,,

i added the same codes to same places but the picture still showing big in details page ,

for ex: i want the picture to show 750x750 but when they download via multi download it download the organal one with the high Q not this one with 750x750

if i have image with 2500x2500 , then it show in 750x750  and when they download they download from the 2500x2500 not from 750x750

means i want to show the picture without resizing the image

please help O_O

thanks
Title: Re: [MOD] Alternate directory for download files.
Post by: Rembrandt on September 16, 2012, 06:01:11 AM
The Mod works only per FTP upload.
Have you 4i Version 1.7.7 or older, you must have v@nos "checkimages.php", in newer 4i Versions is v@nos "checkimages.php" included.
Title: Re: [MOD] Alternate directory for download files.
Post by: madynmalfi on September 16, 2012, 01:15:38 PM
i have 1.7.11  , and yes i am using FTP to upload the images , but when i finished editing the codes like what you said , http://www.4homepages.de/forum/index.php?topic=7499.msg148451#msg148451

then i didn't see changes in my details page ! , what should i do to make the pictures look smaller but with same Q

thanks
Title: Re: [MOD] Alternate directory for download files.
Post by: wallward on February 02, 2014, 03:56:18 PM
thank you
how to update download counter ?  :idea:
when click on
Code: [Select]
<a href ="{show_big}" onclick="void(window.open(this.href,this.target,'top=100,left=200,width={big_width},height={big_height},toolbar=no, directories=no, resizable=yes,menubar=no,locationbar=no,scrollbars=auto'));return false;">no happens in count number :(
Title: Re: [MOD] Alternate directory for download files.
Post by: Jasi on August 29, 2015, 09:47:51 PM
@ ALL

Löscht man Bilder werden die Originalbildfiles im Ordner /big nicht mit gelöscht!

Wer hat eine Lösung dass auch die Originalbildfiles im Ordner date/media/xxxx/big mit gelöscht werden?

Danke schon mal für die Hilfe :-)
Title: Re: [MOD] Alternate directory for download files.
Post by: nobby on August 30, 2015, 09:39:25 PM
Hallo,

ich konnte die Originale über das ACP immer löschen.

Lediglich die Thumbnails im Entsprechenden Ordner musste ich manuell entfernen.

nobby