Topic: long page load times after installing lightbox mod

Hello,

I recently installed the lightbox mod (http://www.punres.org/viewtopic.php?id=1733) on my forum (http://www.teamg3.com/forum). I noticed that on any thread with pictures the load times were horrible. I enabled debug mode to get the times:

this thread has no pictures:
http://www.teamg3.com/forum/viewtopic.php?id=353
[ Generated in 0.111 seconds, 9 queries executed ]

this has several:
http://www.teamg3.com/forum/viewtopic.php?id=333
[ Generated in 11.989 seconds, 9 queries executed ]

i put my original parser.php back and this made the times back to normal on picture threads.

here is the code that is changed in parser:

#
#---------[ 6. FIND (line:293) ]---------------------------------------------------
#

    else if (!$is_signature && $pun_user['show_img'] != '0')
        $img_tag = '<img class="postimg" src="'.$url.'" alt="'.htmlspecialchars($url).'" />';

#
#---------[ 7. REPLACE WITH ]---------------------------------------------------
#

    else if (!$is_signature && $pun_user['show_img'] != '0')
    {
        if (@fclose(@fopen($url, "r")))
        {
            $imagehw = GetImageSize($url);
            $width = $imagehw[0];
            $height = $imagehw[1];
            $img_tag = '<img class="postimg" src="'.$url.'" alt="'.htmlspecialchars($url).'" />';
            if ($width > 550)
            {
                $img_tag = '<a href="'.$url.'" rel="lightbox">' . $img_tag . '</a>';
            }
        }
        else
        {
            $img_tag = '<strong>error: image ' . $url . ' cannot be loaded.</strong>';
        }
    }



#
#

am i doomed to slow load times with this mod? is it because the server i am on just can't process it enough? or because it has to download it and process it?

thanks for your help,
John

2

Re: long page load times after installing lightbox mod

Rickard and I experimented with the getimagesize() function a long time ago to improve image handling in posts. It brought the forum to its knees. The problem is if the images are on a slow remote server or even worse are missing then everything stalls until the image information can be obtained. The conclusion was that getimagesize() is only usable when the images are hosted locally.

Re: long page load times after installing lightbox mod

is there a way to rewrite it so the getimagesize() function is only called when they click the image?

Re: long page load times after installing lightbox mod

That would defeat the purpose tongue
My only suggestion would be to move some of this stuff into a new file which is called via the <img> tag