1 (edited by Tjalve 2006-11-09 17:23)

Topic: Long loading times, post with images

Having some pretty long loading times if a post have pictures in em.
No matter if it's 1 or 100.

Feks:
http://forums.epixplx.com/viewtopic.php?id=2386
and any thread in this forum:
http://forums.epixplx.com/viewforum.php?id=37
But if I load my news page it loads pretty fast.
News:
http://www.epixplx.com/


Base:
Punbb 1.2.14
Mods:
Private messaging
Gallery
RSS Manager
Broadcast Email
HTML for admins/mods and another group I added. (Still slow if the person is in a normal user group (non html))
Polls
Last posts hack
10-20ish home made bbcodes.
Modern bbcode.
probably some more but I cant remember all sad


my [img] function from the parser. (modern bbcode moded)

// Turns an URL from the [img], [imgr], [imgl] tags into an <img> tag or a <a href...> tag. ADDED BY MOD: MODERN BBCODE
//
function handle_img_tag_modern($align, $url, $is_signature = false)
{
    global $lang_common, $pun_config, $pun_user;

    $img_tag = '<a href="'.$url.'"><'.$lang_common['Image link'].'></a>';

    if ($is_signature && $pun_user['show_img_sig'] != '0')
        $img_tag = '<img class="sigimage" src="'.$url.'" alt="'.htmlspecialchars($url).'" />';
    else if (!$is_signature && $pun_user['show_img'] != '0')
    {
        if ($align != '')
            $img_tag = '<img class="postimg" style="float: '.$align.'; clear: '.$align.'" src="'.$url.'" alt="'.htmlspecialchars($url).'" />';
    }

    return $img_tag;
}

//
// Turns an URL from the [img] tag into an <img> tag or a <a href...> tag
//
function handle_img_tag($url, $is_signature = false)
{
    global $lang_common, $pun_config, $pun_user;

    $img_tag = '<a href="'.$url.'" onclick="window.open(this.href); return false;"><'.$lang_common['Image link'].'></a>';

    if ($is_signature && $pun_user['show_img_sig'] != '0')
        $img_tag = '<img class="sigimage" src="'.$url.'" alt="'.htmlspecialchars($url).'" />';
    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>';
        }
    }
    return $img_tag;
}

Hope someone can help smile

Post hoc ergo propter hoc

Re: Long loading times, post with images

The problem is your call to getimagesize.
That's something added by a mod, it's not a PunBB thing.
Essentially, your page has to download all of the images itself prior to showing the page. Not good tongue

Re: Long loading times, post with images

Ah didn't even notice it... ripped it out now.
thanks!

Post hoc ergo propter hoc

Re: Long loading times, post with images

Well, the problem is that the lightbox mod will now be useless tongue