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

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

0 Members and 1 Guest are viewing this topic.

flokoc

  • Guest
Re: Different download options / Verschiedene Download Möglichke
« Reply #75 on: October 22, 2006, 05:42:16 PM »
I think I did it:

look for
Code: [Select]
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
and replace it with
Code: [Select]
$file_path = ROOT_PATH."/data/download/".$image_row['cat_id']."/".$image_row['image_media_file'];
only 2 changes! - seems it works!  :D

I want to resize all images and keep the original in a folder called "download" i tried the above modification, but it still seems to be taking the file from the original cat if folder (the file that I resized and not the saved original in download folder) what could be wrong?

path: resized image: .../data/#/  and orginal: .../data/#/download/

Thanks in advance



I have the same problem. Anyone knows how to solve the problem ?

Offline Lukazs

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #76 on: November 01, 2006, 02:11:11 PM »
I got no error, but my additional download buttons is blured (like i would not have permissions to download image, but i am sure that download option in CP is set to "ALL" and normal download button is working fine.) What could be that? maybe my 4images version is bad? My version 1.7.3.

Thank you for help and your time.

Offline petya

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: Different download options / Verschiedene Download Möglichke
« Reply #77 on: November 09, 2007, 11:20:05 PM »

I read the whole thread. Is there any example in the web to see this mod in action?

Can I do this with the mod?
- upload a high-res picture
- automatic resized in 4 sizes, which are automatic saved in different folders
- can put each in the lightbox
- download the lightbox (cart)

I have same question. Is this possible?

I am surprised, that this feature is not in the CORE  :( Every Photographer which will offer Images over the web needs this function. Preview images, and download the full Print version and Full Size of an Image. So I hope this feature is in Core as Donwload Option in the Future, also a simple Workflow to Upload ONE Image and generate all other Thumbs from this one. No Upload more Images....

Thanks Roland

He is got it wright. That how the progam should work.
Have anybody find the answer to Roland's question?

Offline Intellutions

  • Pre-Newbie
  • Posts: 1
    • View Profile
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #78 on: December 02, 2007, 03:36:30 PM »

Kudos: This is a great mod, thank you.  I was able to change it a bit to support multiple file types instead of different resolutions, and it's working very well for that.

Problem: It seems the code placed into functions.php (after the "$allow_download = 1;" line) runs not only for the detail image, but also for the Random Image that appears to the left of the page.  In fact, it looks to run twice for that image, then once for the detail image.

This might not sound like an issue, but it is when I don't have all the same file types for all the images in the gallery. :(

What happens, is the {download_button} arrays are generated but if the random image has a file type that the detail image doesn't, the {download_button} for that file type is actually for the random image when it appears on the page.  (If the file type existed for the detail image that array would have been overwritten.)

Question:  Is there a way to make sure that the {download_button} arrays are only generated for the detail image, and not the random image that's also on the page?

I found I have access to the image_id field when building the arrays, so I was tempted to use that in the {download_button} array name, but I don't know if I can build those array names on the fly in details.html when the page loads.

Any ideas?

Thank You,
Rich

jojomart

  • Guest
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #79 on: December 12, 2007, 10:39:11 PM »
OK, guys I need your help  :(

I've created a new directory under one of my categories and called it "800" because the images inside of the folder are 800 x 600. I've replaced all the main images for the category into 1024 x 768, so I don't need an additional button for those, and they are showing up fine on the details page.

Here is the code I changed for the mod:

Code: [Select]
$additional_download_sizes = array(800);

  $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_800_off.gif")."\" border=\"0\" alt=\"\" />";
      $register_array['download_zip_button_'.$size] = (function_exists("gzcompress") && function_exists("crc32")) ? "<img src=\"".get_gallery_image("download_800_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_800.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_800_zip.gif")."\" border=\"0\" alt=\"\" /></a>" : "";
    }
  }
  $site_template->register_vars($register_array);

It's probably not right LOL

Here's what I put in my details.html file:

Code: [Select]
&nbsp;&nbsp;&nbsp;&nbsp;{download_button_800}&nbsp;&nbsp;{download_zip_button_800}
[EDIT]
The 800 buttons are showing up on the details page, but they're grayed out, so I can't use them, even when I've logged in.

What do I have to change in the script so that the code will know to look for the 800 sized images in that directory. Do these new 800 images have to be inserted into the database too? And if so, how do I do that?

Please help quick  :oops:

Joanne


EDIT:

WOOHOO I got it working, only thing now is I have to start from scratch - delete what's in my database already and start over "groan"
« Last Edit: December 13, 2007, 03:48:46 AM by jojomart »

Offline scaners

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #80 on: December 16, 2007, 08:52:19 AM »
Whether and it is possible to make so that it was possible to appoint buttons not to all categories, and for what that of the certain categories?

jojomart

  • Guest
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #81 on: December 29, 2007, 05:46:04 AM »
Ok, everyone, I almost have it working where guests can download one size 800x600, but only registered users can download 1024x768 images. Only problem I'm having is that the registered users buttons for the 1024 are showing greyed out even when they're logged in. I added a new column in the categories table - auth_download_1024, and added a line in admin's edit categories section to set the regular downloads to "All" for guests and registered users, and the 1024x768 downloads to "Registered Users" only, and I checked the database and it is applying the permissions correctly.

Here is my code from includes/functions.php

Code: [Select]
  if (!check_permission("auth_download", $image_row['cat_id'])) {
    $download_button = "<img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" />";
    $download_zip_button = (function_exists("gzcompress") && function_exists("crc32")) ? "<img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" />" : "";
    $allow_download = 0;
    clear_download_token($image_row['image_id']);
  }
  else {
    $target = (!empty($image_row['image_download_url']) && !is_remote_file($image_row['image_download_url']) && !is_local_file($image_row['image_download_url'])) ? "target=\"_blank\"" : "";
    $download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\"".$target."><img src=\"".get_gallery_image("download.gif")."\" border=\"0\" alt=\"\" /></a>";
    $download_zip_button = ($target == "" && function_exists("gzcompress") && function_exists("crc32")) ? "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=zip&amp;".URL_IMAGE_ID."=".$image_row['image_id'])."\"".$target."><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>" : "";
    $allow_download = 1;

 $additional_download_sizes = array(1024);

  $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']."/").$regs[1]."_".$size.".".$regs[2];
  if (!check_permission("auth_download_1024", $image_row['cat_id'])) {
      $register_array['download_button_'.$size] = "<img src=\"".get_gallery_image("download_off_1024.gif")."\" border=\"0\" alt=\"\" />";
      $register_array['download_zip_button_'.$size] = (function_exists("gzcompress") && function_exists("crc32")) ? "<img src=\"".get_gallery_image("download_zip_off_1024.gif")."\" border=\"0\" alt=\"\" />" : "";
    $allow_download = 0;
    clear_download_token($image_row['image_id']);
    }
    else {
      $register_array['download_button_'.$size] = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id']."&amp;size=".$size)."\"".$target."><img src=\"".get_gallery_image("download_1024.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;size=".$size)."\"><img src=\"".get_gallery_image("download_zip_1024.gif")."\" border=\"0\" alt=\"\" /></a>" : "";
    $allow_download = 1;
    }
  }
  $site_template->register_vars($register_array);
 

I'd really appreciate it if someone could tell me where I'm going wrong with the code.

Hey another weird thing happened since doing this - I have installed the code to place a thumbnail next to the category title on the main page, but when I click to make a change in the "Edit Categories" section, the image number for the category thumb disappears, and I have to reinsert it each time I modify the section.  Any ideas why??

Thanks,

Joanne

jojomart

  • Guest
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #82 on: December 30, 2007, 05:45:49 PM »
Hey Everyone!

GOT IT WORKING!!!

Here's Jan's original code from page 2:

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);

And here's what I changed it to:

Code: [Select]
$additional_download_sizes = array(1024);
$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 (!check_permission("auth_download_$size", $image_row['cat_id'])) {

       $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;size=".$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;size=".$size)."\"><img src=\"".get_gallery_image("download_zip_$size.gif")."\" border=\"0\" alt=\"\" /></a>" : "";

}

  }
  $site_template->register_vars($register_array);
 

So this:

Code: [Select]
    if (!$allow_download || !get_file_path($file, "media", $image_row['cat_id'], 0, 0)) {
was changed to this:

Code: [Select]
  if (!check_permission("auth_download_$size", $image_row['cat_id'])) {
So now my non-registered visitors will only be able to download 800 x 600 wallpapers, but my registered visitors will be able to download both 800 x 600 and 1024 x 768 wallpapers. And for the non-registered visitors it shows the 1024 x 768 buttons, but they are greyed out, and there are no links showing even in page source, so they can't get the link to the bigger size!

Joanne

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #83 on: December 30, 2007, 06:44:16 PM »
Very good but please change:

Code: [Select]
ereg("(.+)\.(.+)", basename($image_row['image_media_file']), $regs);

for:

Code: [Select]
ereg("(.+)\.(.+)", get_basefile(stripslashes(trim($image_row['image_media_file']))), $regs);

And correct for check_permission function . Is right one for permission. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

jojomart

  • Guest
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #84 on: December 30, 2007, 07:42:40 PM »
Thanks!

jojomart

  • Guest
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #85 on: January 06, 2008, 04:56:22 PM »
Hi everyone,

I am using the different downloads options mod, as well as the batch copy and move mod, and I'd like to allow the script to look in a different directory for the new images when I'm using the Check New Images" feature. Right now it only looks in the base category id. What I want to do is allow it to look in a different subfolder - ex: catid 19/1024/ for newly uploaded images, as well as looking in the base folder. The reason I need this is that I want to upload some 1600x1200 images into the already created 1024 subfolder, then convert them to 1024x768 and save the original 1600x1200 file into a new subfolder called 1600.

I hope I explained it ok - can someone help me with this?

Thanks!

Joanne

EDIT:  Never mind - I decided I'll stick with the two sizes for now - it's just too much trouble.
« Last Edit: January 06, 2008, 08:00:01 PM by jojomart »

jojomart

  • Guest
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #86 on: January 08, 2008, 10:57:24 PM »
I made a widescreen category that has jpg's in just the one size of 1440 x 900 - and I want to allow a button for only that size on the widescreen details page - is that possible? or should I just leave the regular buttons there and they can download it with the regular download button? There is only the one size in that category so they're in media/20/ with no subfolders

Thanks,

Joanne

jojomart

  • Guest
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #87 on: January 09, 2008, 04:13:45 PM »
I was asked to move this topic here:

I can't figure out how to get the zip downloads in lightbox to download everything I have in there. It only wants to download one at a time. Isn't it supposed to download whatever you have listed there? I do have this mod installed, and maybe this is the problem?

I'm using 1.74 script.

thanks,

Joanne

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #88 on: January 09, 2008, 05:13:31 PM »
I was asked to move this topic here:

I can't figure out how to get the zip downloads in lightbox to download everything I have in there. It only wants to download one at a time. Isn't it supposed to download whatever you have listed there? I do have this mod installed, and maybe this is the problem?

This is right. I check Jan code and ZIP is no work from lightbox. I no test this but I like this so here:

In includes/functions.php file,

find:

Code: [Select]
 $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']."/").$regs[1]."_".$size.".".$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;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;size=".$size)."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>" : "";
    }
  }
  $site_template->register_vars($register_array);

replace:

Code: [Select]
 $register_array = array();
  foreach ($additional_download_sizes as $size) {
    preg_match("/(.+)\.(.+)/", get_basefile(stripslashes(trim($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']."/").$regs[1]."_".$size.".".$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=\"\" />" : "";
    } elseif ($allow_download && get_file_path($file, "media", $image_row['cat_id'], 0, 0) && preg_match("/lightbox\.php/", $self_url) && sizeof($user_info['lightbox_image_ids']) > 0 && function_exists("gzcompress") && function_exists("crc32")) {
      $register_array['download_zip_button_'.$size] = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=lightbox&amp;size=" . $size)."\"".$target."><img src=\"".get_gallery_image("download_zip_" . $size . ".gif")."\" border=\"0\" alt=\"\" /></a>";
    } elseif ($allow_download && get_file_path($file, "media", $image_row['cat_id'], 0, 0) && preg_match("/lightbox\.php/", $self_url) && sizeof($user_info['lightbox_image_ids']) <= 0 || !function_exists("gzcompress") || !function_exists("crc32")) {
      $register_array['download_zip_button_'.$size] = "<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;size=".$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;size=".$size)."\"><img src=\"".get_gallery_image("download_zip_" . $size . ".gif")."\" border=\"0\" alt=\"\" /></a>" : "";
    }
  }
  $site_template->register_vars($register_array);
« Last Edit: August 27, 2011, 01:52:59 PM by thunderstrike »
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

jojomart

  • Guest
Re: Different download options / Verschiedene Download Möglichkeiten
« Reply #89 on: January 09, 2008, 05:55:55 PM »
I changed what you said to and got the following error messages:

Warning: Invalid argument supplied for foreach() in /home/wannaber/public_html/wallpaper-downloads/includes/functions.php on line 378

Warning: Invalid argument supplied for foreach() in /home/wannaber/public_html/wallpaper-downloads/includes/functions.php on line 378

Warning: Invalid argument supplied for foreach() in /home/wannaber/public_html/wallpaper-downloads/includes/functions.php on line 378

Warning: Invalid argument supplied for foreach() in /home/wannaber/public_html/wallpaper-downloads/includes/functions.php on line 378