Author Topic: Download doesn't work!  (Read 13985 times)

0 Members and 1 Guest are viewing this topic.

Offline m00mo0

  • Pre-Newbie
  • Posts: 5
    • View Profile
Download doesn't work!
« on: May 10, 2002, 11:03:03 AM »
Hi,
I am using 1.5beta, and download doesn't work. Even the download zip button has disappeared.

the error I get is this

Warning: Cannot add header information - headers already sent in /usr/local/webapps/farn/gallery/4images/download.php on line 106

Warning: Cannot add header information - headers already sent in /usr/local/webapps/farn/gallery/4images/download.php on line 107

Warning: Cannot add header information - headers already sent in /usr/local/webapps/farn/gallery/4images/download.php on line 108

followed by a huge chunk of rubbish.

you can view it at this url

http://www.yifarn.com/gallery/4images/index.php

pls help!....thanks!

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Download doesn't work!
« Reply #1 on: May 10, 2002, 01:55:10 PM »
Hi,

strange...try this:
open "download.php" and replace:
Code: [Select]
@readfile($file_path);

with:
Code: [Select]
ob_implicit_flush(0);
$fp = fopen($file_path, "rb");
fpassthru($fp);


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

Offline m00mo0

  • Pre-Newbie
  • Posts: 5
    • View Profile
Download doesn't work!
« Reply #2 on: May 10, 2002, 04:05:51 PM »
Hi Jan,

Thanks for your quick reply  :)

I tried it but it doesn't work  :cry:

but i realized when i comment out the lines

      header("Content-type: application/octet-stream");
      header("Content-length: $file_size");
      header("Content-Disposition: attachment; filename=\"$file\"");

and click on the download button, it brings me to the image instead of a popup download box.

I also thought it could be due to IE but I tried with opera browser and its the same thing....

any ideas?

thanks!  :P

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Download doesn't work!
« Reply #3 on: May 10, 2002, 04:11:26 PM »
Do you use only images stored on your server or also images linked from other servers?

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

Offline m00mo0

  • Pre-Newbie
  • Posts: 5
    • View Profile
Download doesn't work!
« Reply #4 on: May 11, 2002, 05:32:06 AM »
The images are located on one server only.

When I uploaded the image and thumbnail I only have to fill in either the upload file location or the url right?

 :?:

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Download doesn't work!
« Reply #5 on: May 11, 2002, 08:03:17 AM »
Yes, thats right. But i want to know, if all images are stored on the same server as 4images is installed, or do you use somtimes the URL field?

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

Offline m00mo0

  • Pre-Newbie
  • Posts: 5
    • View Profile
Download doesn't work!
« Reply #6 on: May 12, 2002, 03:53:25 AM »
Yup,

the images are stored in the same server as 4images

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Download doesn't work!
« Reply #7 on: May 12, 2002, 09:22:13 AM »
Ok, replace in download.php
Code: [Select]
ob_start();
@readfile($file_path);
$file_data = ob_get_contents();
ob_end_clean();
$file_size = strlen($file_data);


with:

Code: [Select]
$file_size = filesize($file_path);
$file_data = fread(fopen($file_path, "r"), $file_size);


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

Offline m00mo0

  • Pre-Newbie
  • Posts: 5
    • View Profile
Download doesn't work!
« Reply #8 on: May 12, 2002, 01:19:48 PM »
Hi Jan,

Thanks alot for all your help. It works now but I think the problem was with using URL instead of using the upload feature.

After amending download.php, I could get the download popup box but the images filesize = 0 bytes, so an empty file gets downloaded.

But if I use the upload file instead of specifying URL, the download works.

Thanks!
 :wink:

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
I think I have a similar issue
« Reply #9 on: May 14, 2002, 05:20:48 AM »
I too see the download zip button disappearing.  My details and lightbox templates both contain {download_button} and {download_zip_button}

1.  In the details.php view, if there is no user logged in, I see the download_zip_off.gif button.  If I log in, the button isn't replaced by download_zip.gif, it just disappears entirely.

2.  The lightbox.php view doesn't display the download_off.gif button.  Obviously I can't view a lightbox if there is no user logged in.

Additional info:

I have 4 images referenced by URLs and 1 that was uploaded.  All images reside on the same server where 4images is installed.  All are in the master domain, which is to say that there is no subdomain involved.  The details.php view was for the uploaded file.  The lightbox contained only the 1 image that was uploaded.  

Any ideas?

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: I think I have a similar issue
« Reply #10 on: May 14, 2002, 08:00:53 AM »
Quote from: Chris
1.  In the details.php view, if there is no user logged in, I see the download_zip_off.gif button.  If I log in, the button isn't replaced by download_zip.gif, it just disappears entirely.


To use the "download as zip" feature you need the module zlib installed on your server. You can check this with phpinfo().

Quote from: Chris
2.  The lightbox.php view doesn't display the download_off.gif button.  Obviously I can't view a lightbox if there is no user logged in.

Thats right, only logged in users can use the lightbox.

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

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Thanks
« Reply #11 on: May 14, 2002, 07:29:42 PM »
I figured it was missing a module.  At the time, I didn't even think it might be zlib but now it seems obvious.  Thanks.  I've asked my web host to install it for me.

How do you use phpinfo()?  I looked at page_footer.php but wasn't able to figure out how to trigger the if-statement.

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Download doesn't work!
« Reply #12 on: May 14, 2002, 07:52:45 PM »
Simply create a php file with this code

Code: [Select]
<?php
phpinfo
&#40;&#41;;
?>


this will show you all coniguration informations about your installed php version.

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

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
zlib is installed but still no download zip button
« Reply #13 on: May 18, 2002, 12:16:38 AM »
My server's phpinfo():
(edit - removed, url no longer valid)

zlib appears to be installed:
[Chris@webspace1 dev]$ rpm -qa | grep zlib
zlib-1.1.3-25.7
zlib-devel-1.1.3-25.7

The 4Images admin control panel has "Use GZip compression" enabled.  PHP safe mode is off and still I do not get a "Download As Zip" button.  

Is there some add-on PHP module required?  Any other ideas???

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Download doesn't work!
« Reply #14 on: May 18, 2002, 01:00:21 AM »
hi,


Code: [Select]

'./configure' '--with-apache=../apache_1.3.23' '--with-config-file-path=/etc' '--with-mysql=/usr/local/mysql' '--with-gd' '--enable-ftp' '--with-xml'


your PHP ist NOT compiled with zlib.
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi