Possible Memory Issue affecting my lightbox gallery

Status
Not open for further replies.

ben reilly tribute

New Member
Messages
23
Reaction score
0
Points
1
Not sure what the problem is with my gallery... Images that are larger than the window (and would be reduced in size with a link to the full size image) do not load properly, and the thumbnail images aren't loading properly either in the index or the spinner.

http://www.benreillytribute.x10host.com/enforcer/

Is it possible that It has something to do with my server's php rules (perhaps memory, perhaps something else). Can anyone help with this?
 

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
I don't believe this is a memory problem; I was able to locate an error_log in enforcer/libraries/error_log, and the last ton of lines indicate a coding problem:

Code:
[19-Sep-2013 21:10:20 America/Chicago] PHP Warning:  imagejpeg(): Filename cannot be empty in /home/enforcer/public_html/enforcer/libraries/thumb.display.php on line 222
[19-Sep-2013 21:10:20 America/Chicago] PHP Warning:  imagejpeg(): Filename cannot be empty in /home/enforcer/public_html/enforcer/libraries/thumb.display.php on line 222
[19-Sep-2013 21:10:20 America/Chicago] PHP Warning:  imagejpeg(): Filename cannot be empty in /home/enforcer/public_html/enforcer/libraries/thumb.display.php on line 222
[19-Sep-2013 21:10:20 America/Chicago] PHP Warning:  imagejpeg(): Filename cannot be empty in /home/enforcer/public_html/enforcer/libraries/thumb.display.php on line 222
[19-Sep-2013 21:10:20 America/Chicago] PHP Warning:  imagejpeg(): Filename cannot be empty in /home/enforcer/public_html/enforcer/libraries/thumb.display.php on line 222
[19-Sep-2013 21:10:25 America/Chicago] PHP Warning:  imagejpeg(): Filename cannot be empty in /home/enforcer/public_html/enforcer/libraries/thumb.display.php on line 222

I'm not sure exactly how imagejpeg works, but it apparently requires a filename in that script, and it's not getting one. That's not saying there isn't a memory issue as well, but this is definitely causing a problem. If there's a memory error, it'll appear in that error log once this error's fixed as well (and near as I can tell it's a script problem, not a php problem, as it's not complaining about a blocked function).
 

ben reilly tribute

New Member
Messages
23
Reaction score
0
Points
1
Any chance of a server change to correct this issue? I have verified that it is not a problem with my code.
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
It's possible that it's just due to some minor differences in our PHP configuration.

If you're able, could you provide us with the ouput of phpinfo() on the server that the script works on?

Thanks,
 

ben reilly tribute

New Member
Messages
23
Reaction score
0
Points
1
unfortunately I don't know how to access that information. The only thing I can use from it is that it runs the code properly, and for some reason x10Hosting doesn't.
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
You just create a PHP page with one command, phpinfo(); then open that in your browser.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Code:
[19-Sep-2013 21:10:20 America/Chicago] PHP Warning:  imagejpeg(): Filename cannot be empty in /home/enforcer/public_html/enforcer/libraries/thumb.display.php on line 222

The error message is telling you the problem.
It's not a memory issue.
It is a PHP/GD version issue.
The script is old. imagejpg() used to allow you to set the second parameter, the filename, to the empty string. Recent changes in the function in PHP/GD requires you to set it to NULL instead. Whoever is selling the script has not updated it.

Open thumb.display.php in the cPanel FileManager Code Editor.
Find line 222.
Copy lines 220-224 and post them here (label the lines so we know exactly what line 222 is). Put them in CODE tags.
We should be able to tell you how to change it so that it works.

EDIT: Post the lines around line 251 also. I get an error message from there too. (Did you change the code since the original post?)
 
Last edited:

ben reilly tribute

New Member
Messages
23
Reaction score
0
Points
1
Yeah, I've tried an updated version of thumb.display.php since

Code:
imagefilledrectangle($thumb, 0, 0, $error_size, $error_size, $bg_color);
           
        222 // output an errmsg
        $fnum = ($img_maxsize >= 70) ? 2 : 1;
        $msg_height = 12;
        $msg_array = explode(":",$error_msg);
        for ($i=0; $i<count($msg_array); $i++) {
            imagestring($thumb, $fnum, 2, 2+($msg_height*$i), $msg_array[$i], $fg_color);
249-251
Code:
//// display created image ////
    header("Content-type: image/jpeg");
    imagejpeg($thumb, '', $img_quality);
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
Try changing the last line from
Code:
imagejpeg($thumb, '', $img_quality);

to

Code:
imagejpeg($thumb, NULL, $image_quality);
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
Updated. Issue persists.
The only message I'm seeing is a PHP_NOTICE... that should not affect functionality at all, and you can just turn off error reporting in the script.

Where are you getting other errors?
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
I'm not getting any errors... the thumbnails and over sized images just don't load.

Exacty, step by step, what is wrong?

What I see:

1. I load http://www.benreillytribute.x10host.com/minishowcase/ and there is a PHP error (Undefined Index) at the beginning of the load that is partially obscured when the dark grey background comes in.

2. I see no images. (none on your "working" site either)

3. I click on "Florida/sunset" -- all the thumbnails except for the last (video) load

4. I click on a thumbnail. The image comes up in a shadow box with a line of thumbs across the top. The thumbs are "bad". They are not images. They are (despite the .jpg extension) text saying:
Code:
<br />
<b>Warning</b>:  imagejpeg(): Filename cannot be empty in <b>/home/enforcer/public_html/minishowcase/libraries/thumb.display.php</b> on line <b>251</b><br />

5. Either you did not correct the script error or the gallery is serving up locally (ie on the server) cached copies.
 

ben reilly tribute

New Member
Messages
23
Reaction score
0
Points
1
My actual site:

http://www.benreillytribute.x10host.com/enforcer/

When you click on an image to open it, the thumbnails above it in the carousel don't load. Also, when you open a large image that needs to be resized smaller to fit on the screen, it doesn't load properly. See screencaps:

Carousel:
CarouselLoad_zpsa39d21fa.jpg


Oversized Images:
OversizedImage_zpse5d8ad85.jpg
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
I updated the scripted, how would I clear cached copies?
No idea. Not my script.

On the page you referenced, the oversized image actually came back as a .html page starting with:

Code:
<br />
<b>Strict Standards</b>:  Only variables should be passed by reference in <b>/home/enforcer/public_html/enforcer/libraries/thumb.display.php</b> on line <b>115</b><br />
<br />
<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /home/enforcer/public_html/enforcer/libraries/thumb.display.php:115) in <b>/home/enforcer/public_html/enforcer/libraries/thumb.display.php</b> on line <b>250</b><br />
<br />
<b>Notice</b>:  Undefined variable: image_quality in <b>/home/enforcer/public_html/enforcer/libraries/thumb.display.php</b> on line <b>251</b><br />

1. Strict Standards -- again, the script is old and does not comply with current scripting standards. Ask the originator of the script for a fix.
2. Warning -- once #1 was output, the headers saying that it is a jpeg instead of text cannot be sent
3. Notice -- the "fix" given by leafpiggy had an error. It's not $image_quality . It should be $img_quality
 
Status
Not open for further replies.
Top