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

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

0 Members and 1 Guest are viewing this topic.

Offline mparker

  • Pre-Newbie
  • Posts: 6
    • View Profile
Different download options / Verschiedene Download Möglichke
« Reply #30 on: March 12, 2003, 01:47:14 AM »
Hello,

I have been trying to use this mod to make it so that if someone clicks on the download link it will download a PDF file. The PDF file will reside in a folder named PDF and have the same name as the image except .jpg will be replaced with .pdf. Is this something that is possible?

Could someone point me in the right direction on how to get this done?

I am sorry if this is a stupid question but my php skills are lacking.

I have also posted this in a new thread.

Thanks for your help.

Matt

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Different download options / Verschiedene Download Möglichke
« Reply #31 on: March 12, 2003, 03:32:40 AM »
Why not just set the download URL to the location of your pdf file?  No mod is needed.

Quote
Download URL
If you fill out this field, the download button will point to the URL you entered, otherwise it will point directly to the image file.

taken from the upload image page.

Offline mparker

  • Pre-Newbie
  • Posts: 6
    • View Profile
Different download options / Verschiedene Download Möglichke
« Reply #32 on: March 12, 2003, 03:47:49 AM »
Quote from: Chris
Why not just set the download URL to the location of your pdf file?  No mod is needed.

Quote
Download URL
If you fill out this field, the download button will point to the URL you entered, otherwise it will point directly to the image file.
taken from the upload image page.

Chris,

Thanks for your help. I knew I could this for each individual image but I want to make this change system wide. It would be a whole lot easier to mod it somehow than to have to do this to hundreds of images. I have tried everything I can think of to try and get it to work. Thanks in advance if anyone can help with this.

Matt
« Last Edit: March 09, 2005, 03:06:35 AM by Chris »

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Different download options / Verschiedene Download Möglichke
« Reply #33 on: March 12, 2003, 11:18:06 AM »
Try this in download.php (not tested):

Add
Code: [Select]
ereg("(.+)\.(.+)", $file['file_path'], $regs);
$file['file_path'] = $regs[1].'.pdf';

below
Code: [Select]
if (!empty($file['file_path'])) {
Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline mparker

  • Pre-Newbie
  • Posts: 6
    • View Profile
Different download options / Verschiedene Download Möglichke
« Reply #34 on: March 12, 2003, 03:56:53 PM »
Quote from: Jan
Try this in download.php (not tested):

Add
Code: [Select]
ereg("(.+)\.(.+)", $file['file_path'], $regs);
$file['file_path'] = $regs[1].'.pdf';

below
Code: [Select]
if (!empty($file['file_path'])) {
Jan


Hell Jan,

Thanks a bunch for your help. This doesn't seem to work. If I am reading the code correctly and it is very possible that I am not I need to have the pdf file in the media folder in place of the jpg file, is this correct? If I do this something downloads but it is just an error code file named with the file name I attempted to download. What I would like to do is have a thumbnail on the thumbnail page and then on the detail page have a larger preview appear but the download button will download a pdf file of the image. Maybe this isn't possible and I need to do it by hand.

Thanks again for your help.

Matt

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Different download options / Verschiedene Download Möglichke
« Reply #35 on: March 12, 2003, 04:48:04 PM »
Ok, sorry. I did a little mistake. Place
Code: [Select]
ereg("(.+)\.(.+)", $file['file_path'], $regs);
$file['file_path'] = $regs[1].'.pdf';
   
ereg("(.+)\.(.+)", $file['file_name'], $regs);
$file['file_name'] = $regs[1].'.pdf';

below
Code: [Select]
if (!empty($file['file_path'])) {
You can now have thumbnail and image files. Pressing the download button offers you a pdf file for download which has the same name as the image file and is located in the same folder:

/data/media/1/test.jpg
/data/media/1/test.pdf

/data/thumbnails/1/test.jpg

Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline mparker

  • Pre-Newbie
  • Posts: 6
    • View Profile
Different download options / Verschiedene Download Möglichke
« Reply #36 on: March 12, 2003, 07:48:14 PM »
Thanks Jan, this works great.

Offline Kollega

  • Pre-Newbie
  • Posts: 9
    • View Profile
Different download options / Verschiedene Download Möglichke
« Reply #37 on: May 06, 2003, 12:16:37 PM »
o.k. - new way!

some different download options are too much work so i want to go a little bit different way.

in want to create a folder in /4images/data/download and let a cronjob make a mirror for new files and directories (first run all new!) - the download folder holds the maximum Quality of my pic´s.

the images in the "normal" /media directory will be resized with "Auto Image Resizer" to a low resolution!

now my question (because my php knowledge is very poor and I don´t want to make great mistakes):

is there a easy way to change the download path for all images to /4images/download/...

thx
Kollega

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Different download options / Verschiedene Download Möglichke
« Reply #38 on: May 06, 2003, 05:44:57 PM »
You have to change just a few lines in download.php. Look for $file['file_path'] an $file_path.

Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Kollega

  • Pre-Newbie
  • Posts: 9
    • View Profile
Different download options / Verschiedene Download Möglichke
« Reply #39 on: May 08, 2003, 02:14:41 PM »
little bit confused now: reading code for about 2 hours - u said I should search for $file_path and so on

Code: [Select]
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];

now I´m confused with the MEDIA_PATH? is media_path a global declaration? should I change this one? - or should I creat a DOWNLOAD_PATH?

Offline Kollega

  • Pre-Newbie
  • Posts: 9
    • View Profile
Different download options / Verschiedene Download Möglichke
« Reply #40 on: May 08, 2003, 02:52:55 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

now I only have to change the image_file_size printout in the details? - any tips where to do so?
b.t.w. if anyone is wondering: the user uploads will go into the normal media directory - after midnight a rsync cronjob will creata a exclude list from the "download" directory and copy the new files into the download directory - after that image magick starts a cronjob resizing the media pictures!

Offline Sheep707

  • Full Member
  • ***
  • Posts: 165
    • View Profile
    • http://www.leeger.net
some optitions...
« Reply #41 on: May 08, 2003, 03:33:43 PM »
I's it possible edit the code (I'm just beginner in PHP) for this opitions:
    normaly, a image is just in the "normal" media folder, download this file
    is a picture in the download
and "normal" media floder -> show the normal picure and download the the one from the downlad folder
If I upload a file only to the downlad folder, resize with a script the file and save it to the normal folder! So there are two different pictures![/list:u]

Or is it too many of work?
Wer einen Rechtschreibefeher findet, kann ihn behalten!

Offline Kollega

  • Pre-Newbie
  • Posts: 9
    • View Profile
Re: some optitions...
« Reply #42 on: May 08, 2003, 05:10:12 PM »
Quote from: Sheep707
(I'm just beginner in PHP)


me too  :)

think its possible with a if - elseif circle but i ´ve no need! perhaps i´ll try it if i have more time! *sorry*

I´ve made a second installation and work with "try & error"  :D

btw.

the image size in the detail page i found in /includes/functions.php beginning in line 238
search for
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);
    }
  }


replace with
Code: [Select]
$file_size = "n/a";
  if (!is_remote($image_row['image_media_file'])) {
    if ($file_size = @filesize(ROOT_PATH."/data/download/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
      $file_size = format_file_size($file_size);
    }
  }


works fine until now - "Auto image resize" isn´t hurt so far I´ve testet it - seems it works fine in the standard /media directory!

so long
Kollega

Offline mdevane

  • Pre-Newbie
  • Posts: 5
    • View Profile
Different download options / Verschiedene Download Möglichke
« Reply #43 on: May 17, 2003, 09:45:08 PM »
Hi Jan - Tested your mod and it works very well.  Unfortunately, it requires uploading the high/alt res photos into the same directory as the base image.  This could cause all image resolutions to be "checked" into the database, if the user were not careful.

Could this hack be modified to locate the alternative resolution images into a subdirectory (e.g - yoursite/4images/data/media/#/72dpi or  yoursite/4images/data/media/#/150dpi)?  This would minimize chance of indexing the alternate resolution images using the batch upload capability.
Thanks, Mark

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Different download options / Verschiedene Download Möglichke
« Reply #44 on: May 20, 2003, 09:50:37 AM »
Try to change this line:
Code: [Select]
$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];
to
Code: [Select]
$file = ((is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/" : MEDIA_PATH."/".$image_row['cat_id']."/").'highres/'.$regs[1]."_".$size.".".$regs[2];
Now you can create a subfolders called "highres" and store the additional images in it.

Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search