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

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

0 Members and 1 Guest are viewing this topic.

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
Different download options / Verschiedene Download Möglichke
« Reply #45 on: May 20, 2003, 11:54:49 AM »
Quote
Ok, sorry. I did a little mistake. Place
Code:


ereg("(.+)\.(.+)", $file['file_path'], $regs);  
$file['file_path'] = $regs[1].'.pdf';
     
ereg("(.+)\.(.+)", $file['file_name'], $regs);  
$file['file_name'] = $regs[1].'.pdf';


 

below
Code:


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



I use this mood for RAR file is works but I got problem in another category that dont have rar file in it.
now  all download button in every detail page
will save as RAR file. not go back to the image [ JPG ] file.


My idea is, if in that folder don't have RAR file then  the dowload button back to normal again  [ just to download the images ]

any idea Jan :?:

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Different download options / Verschiedene Download Möglichke
« Reply #46 on: May 20, 2003, 12:01:56 PM »
Try this:
Code: [Select]
ereg("(.+)\.(.+)", $file['file_path'], $regs);
$file_path = $regs[1].'.rar;

if (file_exists($file_path)) {
    $file['file_path'] = $file_path;

    ereg("(.+)\.(.+)", $file['file_name'], $regs);
    $file['file_name'] = $regs[1].'.rar;
}
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
doesn't work
« Reply #47 on: May 21, 2003, 01:53:23 AM »
It seem this change doesn't work Jan, I got this error when I click download button

Parse error: parse error, unexpected T_STRING in c:\myserver\scripts\gallery\download.php on line 211

Code: [Select]

if ($user_info['user_level'] != ADMIN) {
    $sql = "UPDATE ".IMAGES_TABLE."
            SET image_downloads = image_downloads + 1
            WHERE image_id = $image_id";
    $site_db->query($sql);
  }

  if (!empty($file['file_path'])) {
  ereg("(.+)\.(.+)", $file['file_path'], $regs);  
  $file_path = $regs[1].'.rar;

 if (file_exists($file_path)) {
    $file['file_path'] = $file_path;

    ereg("(.+)\.(.+)", $file['file_name'], $regs);
    $file['file_name'] = $regs[1].'.rar;  
}


      @set_time_limit(120);


Help Jan :?

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
Different download options / Verschiedene Download Möglichke
« Reply #48 on: May 21, 2003, 02:12:50 AM »
I think there is little misstake, missing single quotes in two lines:
Quote
ereg("(.+)\.(.+)", $file['file_path'], $regs);
$file_path = $regs[1].'.rar';

if (file_exists($file_path)) {
    $file['file_path'] = $file_path;

    ereg("(.+)\.(.+)", $file['file_name'], $regs);
    $file['file_name'] = $regs[1].'.rar';
}
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 mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
Now all works
« Reply #49 on: May 21, 2003, 07:07:54 AM »
Now all works greats....

Thanks V@NO  :D  :D  :D

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Different download options / Verschiedene Download Möglichke
« Reply #50 on: May 21, 2003, 10:03:25 AM »
Whoops, thanks V@no!

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

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
U2 Jan
« Reply #51 on: May 21, 2003, 11:03:02 AM »
Thanks U2 Jan.

 How to make the file size info in detail page, take from the RAR file [ not from the image ].
 :D  :D  :D

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Different download options / Verschiedene Download Möglichke
« Reply #52 on: May 21, 2003, 11:15:30 AM »
Add:
Code: [Select]
 $register_array['download_size_'.$size] = format_file_size(filesize($file));
before
Code: [Select]
 }
$site_template->register_vars($register_array);

and use {download_size_72}, {download_size_150} etc. in the template.
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
No I mean the info size will for rar extention ?
« Reply #53 on: May 21, 2003, 12:07:01 PM »
No I mean the info size will for RAR  extention ? :wink:

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Different download options / Verschiedene Download Möglichke
« Reply #54 on: May 21, 2003, 12:31:52 PM »
Yes, it is. Whats the problem?  :?

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

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
Ops
« Reply #55 on: May 21, 2003, 12:58:14 PM »
Ops sorry.

I'm confused where do I put this hack [ in detail.php ]
I search for this code in detail, but I couldn't found it.

Code: [Select]
}  
$site_template->register_vars($register_array);

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
Different download options / Verschiedene Download Möglichke
« Reply #57 on: May 22, 2003, 01:32:14 PM »
I still confused Jan ,My idea is just for info file RAR only in spesific category ,
because I don't use this mood for deferent image like you said .
I just use litle hack from this code.

.
Code: [Select]

ereg("(.+)\.(.+)", $file['file_path'], $regs);
$file_path = $regs[1].'.rar';

if (file_exists($file_path)) {
$file['file_path'] = $file_path;

ereg("(.+)\.(.+)", $file['file_name'], $regs);
$file['file_name'] = $regs[1].'.rar';
}



I use this as a download for my template

----------------------------------------------------
Please take a look at my web

user: dream
password : kacanggoreng

www.mantradigital.com/gallery/

visit in DREAM SKINS category after get in detail page,

on info file by default it take from the image JPG file, my wish is the info size file
get from the RAR .


Thanks for taking your time Jan

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Different download options / Verschiedene Download Möglichke
« Reply #58 on: May 22, 2003, 02:56:16 PM »
Ok, i hope this is what you want:

Open functions.php and add

Code: [Select]
ereg("(.+)\.(.+)", $image_row['image_media_file'], $regs);  
$rar_path = MEDIA_PATH."/".$image_row['cat_id']."/".$regs[1].'.rar';  

$rar_size = 0;
if (file_exists($rar_path)) {  
    $rar_size = format_file_size(filesize($rar_path));
}

after
Code: [Select]
elseif ($detailed_view) {
  $file_size = get_remote_file_size($image_row['image_media_file']);
}

and add
Code: [Select]
"rar_file_size" => $rar_size,
after
Code: [Select]
"image_file_size" => $file_size,
Then use {rar_file_size} in the templates.

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

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
Yeap
« Reply #59 on: May 22, 2003, 03:39:57 PM »
Yesss you make my day Jan :D  :D  :D

Thanks