Author Topic: lightbox mod???  (Read 31202 times)

0 Members and 1 Guest are viewing this topic.

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
lightbox mod???
« on: January 07, 2009, 01:14:45 AM »
Ran into an issue at my site and searched around saw allot of questions but no answers to this problem...
A user put a bunch of images in thier lightbox, they got an error when trying to zip download. My server could not create a zip file larger then 20meg in size so it gave up.

Is there a mod that can monitor how big the zip file is when trying to send the lightbox images so it can stop at the server level that it can handle and just download what it is able to?

I also saw people asking if you can limit the number of images in a lightbox without any answers... this would probably work for my site also if there is an answer for it.

Since I am currently having this problem I will probably look into the script myself to see what can be done but would prefer just adding a mod that can do it easier then I will be doing it...

any ideas out there?

thanks,
Buddy Duke
www.budduke.com

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: lightbox mod???
« Reply #1 on: January 07, 2009, 02:26:38 AM »
I haven't seen anyone posted such MODs, both ideas are good and probably doable (I'm not sure though about the monitoring the size of the .zip, not sure if it's even possible) [UPDATE]yes, it's possible with approximate results[/UPDATE].

[EDIT]

Here is a little modification that would skip images in the lightbox zip that would not fit into allocated memory per script.

download attached file, extract it and upload memory.php file into includes/ folder.

In download.php find:
require(ROOT_PATH.'includes/sessions.php');

Insert below:
include(ROOT_PATH.'includes/memory.php');


Then find:
        if (!$file_data = @file_get_contents($file_path)) {

Insert above:
        if (!check_memory(@filesize($file_path)*2)) continue; //we need twice as much memory as the filesize
« Last Edit: January 07, 2009, 03:06:20 PM by V@no »
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 budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: lightbox mod???
« Reply #2 on: January 07, 2009, 08:51:13 PM »
Thanks V@no!
another user PM'd me some code for setting a limit on total images in lightbox.
Will be testing your solution and thiers to see how it all pans out.

your way sound better because I could have a hundred little images that will not fill up the 20meg limit and I could have 4 images that are 5meg a piece, so I think the memory would be the best way to look at it.

will let everyone know how it all goes and what I figured worked the best for my site.
Buddy Duke
www.budduke.com

Offline curgae

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: lightbox mod???
« Reply #3 on: January 13, 2009, 02:33:40 PM »
Hi v@no, I have similar problem so I wanted to modify the download.php as per you suggestion but I can't find the string below

Then find:
if (!$file_data = @file_get_contents($file_path)) {


Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: lightbox mod???
« Reply #4 on: January 14, 2009, 12:46:24 AM »
Hi v@no, I have similar problem so I wanted to modify the download.php as per you suggestion but I can't find the string below

Then find:
if (!$file_data = @file_get_contents($file_path)) {



On an unmodified download.php file it is on line 133

this is the area you are looking for...
Code: [Select]
      if (!empty($file_path)) {
        @set_time_limit(120);
        $file_path = fix_file_path($file_path);
        if (!$file_data = @file_get_contents($file_path)) {  // <- line you are looking for
          continue;
        }
        $zipfile->add_file($file_data, $file_name);
        $file_added = 1;
        unset($file_data);
        $image_ids[] = $image_row['image_id'];
      }
Buddy Duke
www.budduke.com

Offline curgae

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: lightbox mod???
« Reply #5 on: January 14, 2009, 02:46:17 PM »
Hi budduke, that part is a bit different since my file has been updated with some mod (my code is the following)
Code: [Select]
      if (!empty($file_path)) {
        @set_time_limit(120);
      if (!$file_data = get_file_data($file_path)) {
          continue;
        }
        $zipfile->add_file($file_data, $file_name);
        $file_added = 1;
        unset($file_data);
        $image_ids[] = $image_row['image_id'];

actually my problem is slightly different since I "can't" download the file in the lightbox in any dimension no matter if they are more than 20Mb or less. I don't get any error from the web but the download result is a zip corrupted file of 0 bytes.

Any other suggestion?

thanks,
Gaetano

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: lightbox mod???
« Reply #6 on: January 14, 2009, 04:05:15 PM »
is that after this modification or always?
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 curgae

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: lightbox mod???
« Reply #7 on: January 14, 2009, 04:47:35 PM »
Only after upgrading both PHP and MYSQL from old version 4 to:

PHP Version 5.2.5
MYSQL 5.0.41


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: lightbox mod???
« Reply #8 on: January 14, 2009, 04:51:03 PM »
If after replacing in global.php
Code: [Select]
error_reporting(E_ERROR | E_WARNING | E_PARSE);
With:
Code: [Select]
error_reporting(E_ALL);
@ini_set("display_errors", 1);

If You start getting zip files of 1kb, then open that zip file in a text editor and see what kind of errors it has in.
« Last Edit: January 14, 2009, 05:10:59 PM by V@no »
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 curgae

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: lightbox mod???
« Reply #9 on: January 14, 2009, 05:00:10 PM »
Now I get zip files of 16k but still damaged and doesn't let me open it. So I can't read anything

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: lightbox mod???
« Reply #10 on: January 14, 2009, 05:11:44 PM »
Open them in a text editor and see if anything useful there.
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 curgae

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: lightbox mod???
« Reply #11 on: January 14, 2009, 05:38:12 PM »
These are the first lines that should say something useful

<b>Notice</b>:  Undefined index:  file_size in <b>/Users/gaetanocurci/Desktop/WWW_Originale/gallery/download.php</b> on line <b>323</b><br />
<br />
<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /Users/gaetanocurci/Desktop/WWW_Originale/gallery/download.php:323) in <b>/Users/gaetanocurci/Desktop/WWW_Originale/gallery/download.php</b> on line <b>323</b><br />
P

Offline curgae

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: lightbox mod???
« Reply #12 on: January 14, 2009, 05:44:23 PM »
line 323 for me is:

header("Content-Length: ".$file['file_size']."\n\n");

These are the first lines that should say something useful

<b>Notice</b>:  Undefined index:  file_size in <b>/Users/gaetanocurci/Desktop/WWW_Originale/gallery/download.php</b> on line <b>323</b><br />
<br />
<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /Users/gaetanocurci/Desktop/WWW_Originale/gallery/download.php:323) in <b>/Users/gaetanocurci/Desktop/WWW_Originale/gallery/download.php</b> on line <b>323</b><br />
P


Offline V@nо

  • Addicted member
  • ******
  • Posts: 1.223
    • View Profile
Re: lightbox mod???
« Reply #13 on: January 14, 2009, 06:10:42 PM »
yes, that is some progress in the investigation ;)
try use unmodified download.php (but backup current)
Your first three "must do" before you ask a question:
If I asked you to PM me, I meant PM to my primary account, this account doesn't accept PMs.

Offline curgae

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: lightbox mod???
« Reply #14 on: January 14, 2009, 06:26:51 PM »
The only download.php version I have now is the one with Multiples download sizes MOD, where I can find the original version to test for 1.7 version?

yes, that is some progress in the investigation ;)
try use unmodified download.php (but backup current)