• Different download options / Verschiedene Download Möglichkeiten 5 0 5 1
Currently:  

Author Topic: Different download options / Verschiedene Download Möglichkeiten  (Read 168554 times)

0 Members and 1 Guest are viewing this topic.

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #105 on: August 29, 2008, 12:39:55 AM »
I am looking at making a variation of this different download options and was wondering if anyone knew of a way to make a dropdown list next to the download/and zip button that would give you different size options?
Like a list of 72,150,300 and when you click on the download button it would download that version that was selected in the dropdown?

thanks for any input!
Buddy Duke
www.budduke.com

Offline Lunique

  • Full Member
  • ***
  • Posts: 109
  • V 1.7.7
    • View Profile
Re: Different download options / Verschiedene Download Möglichke
« Reply #106 on: February 14, 2009, 03:32:55 PM »
Thank you V@no, for that modification to the mod!!

With some modding of my own, I got it working the way I wanted it... though yours did most of the work...

The problem is if you want to use a folder that is not an integer, that is a whole number. That is because intval is used... So, I remover that from.... this... part

Code: [Select]
 if (isset($HTTP_GET_VARS['size2']) || isset($HTTP_POST_VARS['size2'])) {
    $size2 = (isset($HTTP_GET_VARS['size2'])) ? intval($HTTP_GET_VARS['size2']) : intval($HTTP_POST_VARS['size2']);
  }
  else {
    $size2 = 0;
  }

I changed it to...

Code: [Select]
if (isset($HTTP_GET_VARS['size2']) || isset($HTTP_POST_VARS['size2'])) {
    $size2 = (isset($HTTP_GET_VARS['size2'])) ? ($HTTP_GET_VARS['size2']) : ($HTTP_POST_VARS['size2']);
  }
  else {
    $size2 = 0;
  }

This way it doesn't matter if you use "1024" or "big" as the foldername....

The reason I wanted this is that I wanted to combine it with V@no's hack...
[Mod] Show original image in new window by clicking on image!

In that mod there is a folder is named big and put into the same folder as the images(1,2,3,4...). In the big folder images are put that are (surprisingly) bigger (could of course use smaller too, but what would the point be) Then that image will pop up in a new window... Great mod, I got it working!

Now, I also wanted the option to have a download button for big and also maybe other sizes like 1024 and so on...

But in the big modification there is no extension _big placed after each imagename (and no reason to if you have it in a different foler)... so I had to remove some code from this one as well...

 
Code: [Select]
$additional_download_sizes = array(72, 120, 300);

  $register_array = array();
  foreach ($additional_download_sizes as $size) {
    ereg("(.+)\.(.+)", basename($image_row['image_media_file']), $regs);
    $file = ((is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/" : MEDIA_PATH."/".$image_row['cat_id']."/").$size."/".$regs[1].".".$regs[2];
    if (!$allow_download || !get_file_path($file, "media", $image_row['cat_id'], 0, 0)) {
      $register_array['download_button_'.$size] = "<img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" />";
      $register_array['download_zip_button_'.$size] = (function_exists("gzcompress") && function_exists("crc32")) ? "<img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" />" : "";
    }
    else {
      $register_array['download_button_'.$size] = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id']."&amp;size2=".$size."&amp;size=".$size)."\"".$target."><img src=\"".get_gallery_image("download.gif")."\" border=\"0\" alt=\"\" /></a>";
      $register_array['download_zip_button_'.$size] = (function_exists("gzcompress") && function_exists("crc32")) ? "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=zip&amp;".URL_IMAGE_ID."=".$image_row['image_id']."&amp;size2=".$size."&amp;size=".$size)."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>" : "";
    }
  }
  $site_template->register_vars($register_array);

this I changed to...

  
Code: [Select]
 $additional_download_sizes = array(800, 1024, 1280, 1600, big);

  $register_array = array();
  foreach ($additional_download_sizes as $size) {
    ereg("(.+)\.(.+)", basename($image_row['image_media_file']), $regs);
    $file = ((is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/" : MEDIA_PATH."/".$image_row['cat_id']."/").$size."/".$regs[1].".".$regs[2];
    if (!$allow_download || !get_file_path($file, "media", $image_row['cat_id'], 0, 0)) {
      $register_array['download_button_'.$size] = "<img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" />";
      $register_array['download_zip_button_'.$size] = (function_exists("gzcompress") && function_exists("crc32")) ? "<img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" />" : "";
    }
    else {
      $register_array['download_button_'.$size] = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id']."&amp;size2=".$size)."\"".$target."><img src=\"".get_gallery_image("download.gif")."\" border=\"0\" alt=\"\" /></a>";
      $register_array['download_zip_button_'.$size] = (function_exists("gzcompress") && function_exists("crc32")) ? "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=zip&amp;".URL_IMAGE_ID."=".$image_row['image_id']."&amp;size2=".$size."&amp;size=".$size)."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>" : "";
    }
  }
  $site_template->register_vars($register_array);

The difference lies in that I don't want to send the size value, only the size2 value because size gives the "_big" extension and size2 the name of the folder... I guess it could be changed more, to take away that function all together, but this was an easy change...

so the thing I removed was
Code: [Select]
."&amp;size=".$size from 2 places...

Of course you might want to incorporate Fox Mulder's change to have seperate buttons made for each SIZE or in this case foldername... then the code would look like this... (remember to make buttons named "download_(foldername).gif" and "download_zip_(foldername).gif" Same thing for the ones with "_off". In my case I made an image called "download_big.gif" and one called "download_off_big.jpg)

Code: [Select]
 $additional_download_sizes = array(800, 1024, 1280, 1600, big);

  $register_array = array();
  foreach ($additional_download_sizes as $size) {
    ereg("(.+)\.(.+)", basename($image_row['image_media_file']), $regs);
    $file = ((is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/" : MEDIA_PATH."/".$image_row['cat_id']."/").$size."/".$regs[1].".".$regs[2];
    if (!$allow_download || !get_file_path($file, "media", $image_row['cat_id'], 0, 0)) {
      $register_array['download_button_'.$size] = "<img src=\"".get_gallery_image("download_off_$size.gif")."\" border=\"0\" alt=\"\" />";
      $register_array['download_zip_button_'.$size] = (function_exists("gzcompress") && function_exists("crc32")) ? "<img src=\"".get_gallery_image("download_zip_off_$size.gif")."\" border=\"0\" alt=\"\" />" : "";
    }
    else {
      $register_array['download_button_'.$size] = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id']."&amp;size2=".$size)."\"".$target."><img src=\"".get_gallery_image("download_$size.gif")."\" border=\"0\" alt=\"\" /></a>";
      $register_array['download_zip_button_'.$size] = (function_exists("gzcompress") && function_exists("crc32")) ? "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=zip&amp;".URL_IMAGE_ID."=".$image_row['image_id']."&amp;size2=".$size."&amp;size=".$size)."\"><img src=\"".get_gallery_image("download_zip_$size.gif")."\" border=\"0\" alt=\"\" /></a>" : "";
    }
  }
  $site_template->register_vars($register_array);


Now, I can have a folder named big that works with other mod, I also now have the option of having a download button for getting the biggest file placed in the big folder...
I also have the option of having different folders with different sizes, and downloadbuttons for them...

All in all! I am very pleased!

We are here to share... right??

Thanx!
I'm not to good in english (I'm from germany) so I'm not sure if this would be the right modification to do, so I'm asking first:

Is this modification able to create a second download link for images in folder "big" ?
If yes, will the second download link count on statistics?
will it be grayed out if nothing is found in "big" ?

I'm not sure if I understand what this mod above will do ? I already have a mod working to have 3 sizes for 1 image (thumbnail, small showed on detail page, big one in folder big) and right now you will download the big files if you click on the normal download link, but sometimes the files I upload are to small and are not resized and then the "big" folder is empty and download don't work. So I want to change it back and normal download link links to image shown in details and second download link to the one in folder "big".

Thanks a lot, Lunique

Offline Lunique

  • Full Member
  • ***
  • Posts: 109
  • V 1.7.7
    • View Profile
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #107 on: February 18, 2009, 06:20:02 PM »
Ok I just tried it myself and it worked as I wanted to but now when I'm using search I get following lines at the top of the page:

Code: [Select]
Notice: Use of undefined constant big - assumed 'big' in /usr/export/www/vhosts/funnetwork/hosting/kellypicturesite/includes/functions.php on line 362The code appears as often as images are shown on this page so If I find 24 images during search I have 24times exactly this line and below the search results
On line 362 starts the code of MrWante with
Code: [Select]
$additional_download_sizes = array(800, 1024, 1280, 1600, big);
any solution?

Offline Lunique

  • Full Member
  • ***
  • Posts: 109
  • V 1.7.7
    • View Profile
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #108 on: February 19, 2009, 01:48:02 PM »
I can hide it now with comment out of following line in search.php
Code: [Select]
// error_reporting(E_ALL);
but I would prefer not just to hide it but to fix it

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #109 on: February 19, 2009, 03:16:59 PM »
$additional_download_sizes = array(800102412801600"big");
Should do it.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Lunique

  • Full Member
  • ***
  • Posts: 109
  • V 1.7.7
    • View Profile
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #110 on: February 19, 2009, 03:55:48 PM »
Yes it does! Thanks a lot!

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: Different download options / Verschiedene Download Möglichke
« Reply #111 on: March 06, 2009, 07:15:41 PM »
Hi V@no

How can I modify the following code of yours so that I can use different buttons on Lightbox page do download different file sizes?
(i.e. files from different folder (800, 1024)

if anyone interesting use different folders for different size images, then here is modifyed mod:
change original mod code to this:
Code: [Select]
 $additional_download_sizes = array(72, 120, 300);

  $register_array = array();
  foreach ($additional_download_sizes as $size) {
    ereg("(.+)\.(.+)", basename($image_row['image_media_file']), $regs);
    $file = ((is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/" : MEDIA_PATH."/".$image_row['cat_id']."/").$size."/".$regs[1].".".$regs[2];
    if (!$allow_download || !get_file_path($file, "media", $image_row['cat_id'], 0, 0)) {
      $register_array['download_button_'.$size] = "<img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" />";
      $register_array['download_zip_button_'.$size] = (function_exists("gzcompress") && function_exists("crc32")) ? "<img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" />" : "";
    }
    else {
      $register_array['download_button_'.$size] = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id']."&amp;size2=".$size."&amp;size=".$size)."\"".$target."><img src=\"".get_gallery_image("download.gif")."\" border=\"0\" alt=\"\" /></a>";
      $register_array['download_zip_button_'.$size] = (function_exists("gzcompress") && function_exists("crc32")) ? "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=zip&amp;".URL_IMAGE_ID."=".$image_row['image_id']."&amp;size2=".$size."&amp;size=".$size)."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>" : "";
    }
  }
  $site_template->register_vars($register_array);
I dont know if size= also uses somewhere else, so I just add one more, size2=
so, then open download.php file.
find
Code: [Select]
 if (isset($HTTP_GET_VARS['size']) || isset($HTTP_POST_VARS['size'])) {
    $size = (isset($HTTP_GET_VARS['size'])) ? intval($HTTP_GET_VARS['size']) : intval($HTTP_POST_VARS['size']);
  }
  else {
    $size = 0;
  }
add after:
Code: [Select]
 if (isset($HTTP_GET_VARS['size2']) || isset($HTTP_POST_VARS['size2'])) {
    $size2 = (isset($HTTP_GET_VARS['size2'])) ? intval($HTTP_GET_VARS['size2']) : intval($HTTP_POST_VARS['size2']);
  }
  else {
    $size2 = 0;
  }
then find:
Code: [Select]
   $file['file_path'] = dirname($image_row['image_media_file'])."/".$file['file_name'];
change to this:
Code: [Select]
   $file['file_path'] = dirname($image_row['image_media_file'])."/".(($size2) ? $size2."/" : "").$file['file_name'];
few lines down find:
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 to this:
Code: [Select]
   $file['file_path'] = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".(($size2) ? $size2."/" : "").$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".(($size2) ? $size2."/" : "").$file['file_name'];
I m not a  Programmer.
          But
I m a Good Learner.

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #112 on: March 11, 2009, 05:21:55 AM »
I spent hours trying to find a way to use Lightbox with this Mod of V@no version (Images in diff folders) but no success.
Would certainly appreciate your help :)
I m not a  Programmer.
          But
I m a Good Learner.

Offline Eagle Eye

  • Full Member
  • ***
  • Posts: 191
    • View Profile
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #113 on: March 19, 2009, 03:49:54 PM »
Hello everyone... nice mod.. have a questions:

1) Is it possible to modify the add new images file so that it does not detect anything other than the normal version of image while adding a new image to into database?
2) Can the same be applied to V@no's batch import from zip plugin?
« Last Edit: March 19, 2009, 04:57:30 PM by maxpaul »

Offline lapas

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #114 on: April 11, 2009, 06:27:31 PM »
I want to do that, when clicking on the button download 1280x800 returned pages in a new window with that picture, it is better to separate page to have your own set title(example: thisimage 1280x800)
any ideas?

Offline Eagle Eye

  • Full Member
  • ***
  • Posts: 191
    • View Profile
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #115 on: April 17, 2009, 09:50:49 PM »
I am testing this mod (using the gallery for pdf files with gif files as preview in details page) and have modified it in such a way to show file size (of PDF), and the download feature in details.php downloads the pdf version.
the PDF file and its GIF preview are both sored in the same folders. The GIF file is in database and the PDF file is not.

but when i add all the images to a lightbox (i have lightbox for guest by v@no) and then try to download.. the script is zipping and downloading the image previews (GIF files from the details page) and not the required PDF files.

How to mod this, so that i can download both instead of just the image preview?

in short: would like to download both GIF and PDF in a zip file from lightbox.

Offline innovationsraum

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #116 on: October 22, 2009, 05:18:45 PM »
Hi...

First of all I have to say a big "Thank You" to Jan. I use this mod and it works excellent. I use the mod from Fox Mulder as well to get different Download Buttons.

My regular images are 72dpi and the HighRes Pics are 300dpi. File names of the regular pics for example is "picture001.jpg" and for the same in HigRes "picture001_300.jpg". I upload all pics to a category via FTP and add them to the Database with "Check for new Files" in the Admin Control Panel, but I set the 300 dpi pictures to "active = no". So far so good ;)

I customized my template to get 5 Buttons in the details.html (Lightbox, Download 72dpi, Download 300dpi, ZIP-Download 72dpi and ZIP-Download 300dpi).

Now my question:

Is it possible to have 2 Lightbox Buttons as well ? One to add the 72dpi images (which actually does the "regular" Lightbox Button) and one to add the 300dpi images.

Any help is very welcome