Resize photos automatically

Site Info - Site News - Site Suggestions - Contests
User avatar
Ryom
Insiders
Insiders
Posts: 365
Joined: 25 Jul 2004, 04:41

Resize photos automatically

Post by Ryom »

One week bump!
User avatar
skipclarke
Founder
Founder
Posts: 7358
Joined: 13 Oct 2003, 05:00

Resize photos automatically

Post by skipclarke »

Here are two more quick mods to try:

http://phpbbhacks.com/download/7842 <--- Same as my first link, but coded differently... worth a shot.


This one worked:

Code: Select all

&lt;script&gt; 

   window.onload = resizeimg;
   function resizeimg()
   {
      if (document.getElementsByTagName)
      {
         for (i=0; i&lt;document.getElementsByTagName('img').length; i++)
         {
            im = document.getElementsByTagName('img')[i];
            if (im.width &gt; 853)
            {
               im.style.width = '853px';
               eval(&quot;pop&quot; + String(i) + &quot; = new Function(&quot;pop = window.open('&quot; + im.src + &quot; ','fullscale','width=900,height=500,scrollbars=1,resizable=1'); pop.focus();&quot;)&quot;);
               eval(&quot;im.onclick = pop&quot; + String(i) + &quot;;&quot;);
               if (document.all) im.style.cursor = 'hand';
               if (!document.all) im.style.cursor = 'pointer';
               im.title = 'Click Here To See Image Full Size ';
            }
         }
      }
   }
   
   &lt;/script&gt;


Glad it worked too. The other one had you editing 5 files and running some JavaScript...

I set the width to 768, which should work for everyone. The one thing I'd like to do is figure out how to make the width and height of the pop-up the size of the actual pic. I tried taking out the width and height, and I tried making them 100%. Neither worked. I set at 900x500 as I decent compromise. Any suggestions.
User avatar
g00seberry
Editors
Editors
Posts: 1317
Joined: 24 Sep 2006, 16:57

Resize photos automatically

Post by g00seberry »

Testing, testing! 1, 2 testing!



o0 nice work
Formerly eZ`

Follow me on twitter: @theg00seberry and find me on Steam
User avatar
Ryom
Insiders
Insiders
Posts: 365
Joined: 25 Jul 2004, 04:41

Resize photos automatically

Post by Ryom »

Sweet, thanks :)

Not going to be able to help with the javascript though... hopefully someone knows.
ctrlsteef
Editors
Editors
Posts: 2820
Joined: 17 Nov 2005, 09:02

Resize photos automatically

Post by ctrlsteef »

And what about that "this pic is resized" line. Is that also possible?

Nice work btw. :wink:
Evil Incarnate
Posts: 59
Joined: 30 Apr 2006, 23:06

Resize photos automatically

Post by Evil Incarnate »

Ibrin-

This should make the popup the original size of the image, plus 10 pixels for the body margins; if the image is larger than the user's resolution, the popup should become the size of their screen.

Let me know if that works or not; I am looking into adding the text to notify the user that the image has been resized, but that will take more work.

Code: Select all

&lt;script&gt;

   window.onload = resizeimg;
   function resizeimg()
   {
      if (document.getElementsByTagName)
      {
         for (i=0; i&lt;document.getElementsByTagName('img').length; i++)
         {
            im = document.getElementsByTagName('img')[i];
            if (im.width &gt; 768)
            {
               origW = im.width + 10; // Original Width
                  if (origW &gt; screen.width) origW = screen.width; // Check if Original Width is too big for user's resolution
               origH = im.height + 10; // Original Height
                  if (origH &gt; screen.height) origH = screen.height; // Check if Original Height is too big for user's resolution
               im.style.width = '768px';
               eval(&quot;pop&quot; + String(i) + &quot; = new Function(&quot;pop = window.open('&quot; + im.src + &quot; ','fullscale','width=&quot; + origW + &quot;,height=&quot; + origH + &quot;,scrollbars=1,resizable=1'); pop.focus();&quot;)&quot;);
               eval(&quot;im.onclick = pop&quot; + String(i) + &quot;;&quot;);
               if (document.all) im.style.cursor = 'hand';
               if (!document.all) im.style.cursor = 'pointer';
               im.title = 'Click Here To See Image Full Size ';
            }
         }
      }
   }
   
   &lt;/script&gt;
User avatar
Ryom
Insiders
Insiders
Posts: 365
Joined: 25 Jul 2004, 04:41

Resize photos automatically

Post by Ryom »

Now to add a mod that truncates ridiculously long lines/urls and then the forum will never have horizontal scrolling again :)
NightBlade
Posts: 43
Joined: 31 May 2007, 09:43

Resize photos automatically

Post by NightBlade »

Now to add a mod that truncates ridiculously long lines/urls and then the forum will never have horizontal scrolling again :)


Horizontal scrolling? I thought everyone here had a widescreen monitor :P As for long urls, you can always use http://tinyurl.com/ to fix that up (though of course there's the hidden danger of now knowing exactly what you're clicking into).
User avatar
Ryom
Insiders
Insiders
Posts: 365
Joined: 25 Jul 2004, 04:41

Resize photos automatically

Post by Ryom »

The idea behind the two mods would be so that the work is done automatically and transparently :)

I've got the 2nd highest consumer resolution widely available (1920px) and I still get horizontal scrollbars from people posting massive URLs on occasion. We've fixed scrolling due to images now, so URL scrolling is the only thing thats left :)
User avatar
P-Storm
Posts: 764
Joined: 24 Dec 2006, 18:56

Resize photos automatically

Post by P-Storm »

My little "problem" with that resizing is that the window is first almost the original size, so you have to resize the window with it. But that is just me :roll:

And yeah long links can be a pain, but couldn't you do something like http://wwwthisisarealylonglink.com/ex...../forum so that the ... replace a large chunk of the link.
User avatar
skipclarke
Founder
Founder
Posts: 7358
Joined: 13 Oct 2003, 05:00

Resize photos automatically

Post by skipclarke »

The idea behind the two mods would be so that the work is done automatically and transparently :)

I've got the 2nd highest consumer resolution widely available (1920px) and I still get horizontal scrollbars from people posting massive URLs on occasion. We've fixed scrolling due to images now, so URL scrolling is the only thing thats left :)


People simply need to use the proper BB Code. They need to use

Code: Select all

<a href="http:......">link</a>


Instead of just pasting the link.
ctrlsteef
Editors
Editors
Posts: 2820
Joined: 17 Nov 2005, 09:02

Resize photos automatically

Post by ctrlsteef »

Exactly. It's not that hard. :P
User avatar
P-Storm
Posts: 764
Joined: 24 Dec 2006, 18:56

Resize photos automatically

Post by P-Storm »

Yeah i know it isn't that hard, but we have mutch lazy people on this forum (or getting it when we make this mod happen)
ctrlsteef
Editors
Editors
Posts: 2820
Joined: 17 Nov 2005, 09:02

Resize photos automatically

Post by ctrlsteef »

Thank god for this mod.

http://www.widescreengamingforum.com/node/7847#comment-156144

:bowdown :bowdown

:lol:
User avatar
g00seberry
Editors
Editors
Posts: 1317
Joined: 24 Sep 2006, 16:57

Resize photos automatically

Post by g00seberry »

lol! i was just about to post in that thread and say the same thing :D

Suppose it ends up being a lot less work for the mods!
Formerly eZ`

Follow me on twitter: @theg00seberry and find me on Steam
ctrlsteef
Editors
Editors
Posts: 2820
Joined: 17 Nov 2005, 09:02

Resize photos automatically

Post by ctrlsteef »

Yeah, totally. And since the anti spam measures are working pretty well aswell it's all a lot more easy going for us. :D
User avatar
skipclarke
Founder
Founder
Posts: 7358
Joined: 13 Oct 2003, 05:00

Resize photos automatically

Post by skipclarke »

Adjusted to 853px wide, to maintain aspect in the Detailed Reports.
Post Reply

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot] and 3 guests