1

Topic: Resize Script Help

Okay, now I know where I'm going with this, new question.

Code in header.php

    <script type="text/javascript">

var maxWidth = 785;

function scaleImage(im) {

  if (typeof im.naturalWidth == 'undefined') im.naturalWidth = im.width;

  if (im.naturalWidth > maxWidth) {

    im.width = maxWidth;
    im.style.maxWidth = im.naturalWidth + 'px';
    im.className = 'resized';
    im.title = 'Click for ' + im.src;
    im.style.cursor="pointer";
     im.onclick=openimg;
 

  }

}
function openimg()
{
    window.navigate(this.src,'','');
}
</SCRIPT>

Code in parser

//
// Turns an URL from the [img] tag into an <img> tag or a <a href...> tag
//
function handle_img_tag($url, $is_signature = false, $align='')
{
    global $lang_common, $pun_config, $pun_user;
    
    $style = '';
    if ($align != '')
    {
        $align = strtoupper($align);
        if ($align == 'G' || $align == 'L')
            $style = ' style="float: left; margin: 0 1em 1em 0;"';
        elseif ($align == 'D' || $align == 'R')
            $style = ' style="float: right; margin: 0 0 1em 1em;"';
        elseif ($align == 'C')
            $style = ' style="display: block; margin:0 auto;"';
    }

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

    if ($is_signature && $pun_user['show_img_sig'] != '0')
        $img_tag = '<img class="sigimage" src="'.$url.'" alt="'.htmlspecialchars($url).'"'.$style.' />';
    else if (!$is_signature && $pun_user['show_img'] != '0')
        $img_tag = '<img class="postimg" src="'.$url.'" alt="'.htmlspecialchars($url).'"'.$style.' onload="scaleImage(this);" />';
    return $img_tag;
}

Here's the issue.

http://reviewstash.com/index.php?&p=18

On the index.php clickable resizing works in IE6 but not in Opera or a couple other browsers.

On viewtopic.php it works for all, any ideas?