News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

[TIP] Image Resizer - No xhtml error

Started by Özgür, July 04, 2009, 12:12:25 PM

Previous topic - Next topic

Özgür

This resizer haven't any xhtml error.

Open your index.template.php
Find

</head>

Add before
<script type="text/javascript">
// <![CDATA[
window.onload = resizeimg;
function resizeimg()
{
   if (document.getElementsByTagName)
   {
      for (i=0; i<document.getElementsByTagName(\'img\').length; i++)
      {
         im = document.getElementsByTagName(\'img\')[i];
         if(im.parentNode.className=="resix")
       {
          if (im.width > 700)
          {
            im.style.width = \'700px\';
            eval("pop" + String(i) + " = new Function(\"pop = window.open(\'" + im.src + " \',\'fullscale\',\'width=400,height=400,scrollbars=1,resizable=1\'); pop.focus();\")");
            eval("im.onclick = pop" + String(i) + ";");
            if (document.all) im.style.cursor = \'hand\';
            if (!document.all) im.style.cursor = \'pointer\';
            im.title = \'Click Here To See Image Full Size\';
          }
      }
      }
   }
}
// ]]>
</script>


Maximum image width is 700px. If you want to change this 

        if (im.width > 700)
           {
             im.style.width = \'700px\';

Change 700's.

And resizer only resize message body images. You must the find your message body div. And copy this div class. And change "resix" to your div class.
if(im.parentNode.className=="resix")

I found this on http://phpbbegypt.com/phpBB3/viewtopic.php?f=9&t=79

And demo is here
So Long

Tanks

I tried using this tip because i can't install mods.

But i was unable to get it to work..

i looked for that body div and i am sure that in my theme the body div class is "inner" and i changed resix to inner, but did not work.

here is what i think must be my message body div


<div class="inner">', $message['body'], '</div>


Any help with that, please?

Advertisement: