LocostUSA.com
http://www.locostusa.com/forums/

BBCode code question about image sizing
http://www.locostusa.com/forums/viewtopic.php?f=34&t=14786
Page 1 of 1

Author:  erioshi [ February 18, 2013, 4:35 am ]
Post subject:  BBCode code question about image sizing

Is there BBCode available to display linked images in a "fit to the browser" mode? I recently posted links to some very large pictures, and while they are fine on my system, they will hard for someone with a narrow monitor to view. I would have preferred to add a bit of code to eliminate the width issue for others, but wasn't able to google up a solution.

Author:  TooBusy [ February 18, 2013, 9:29 am ]
Post subject:  Re: BBCode code question about image sizing

I haven't found a solution. I'll fire the question off to a computer geek buddy and see what he comes up with.

Author:  nick47 [ February 18, 2013, 1:11 pm ]
Post subject:  Re: BBCode code question about image sizing

Wow, there doesn't actually seem to be a way to resize photos. If you click the BBCode link under Options: in the lower right corner of the reply page, it takes you to a full tutorial of BBCode. You can resize text apparently, but not pictures. That's weak. I guess you'd have to download the pictures from the other site, resize them yourself, and post them on some other site.

Author:  TooBusy [ February 18, 2013, 1:20 pm ]
Post subject:  Re: BBCode code question about image sizing

auto-resize isn't easy.

Author:  nick47 [ February 18, 2013, 1:23 pm ]
Post subject:  Re: BBCode code question about image sizing

I wrote the forum for our Miata group, and it auto-resizes photos. If I can do it, it's not that tricky.

Author:  rx7locost [ February 18, 2013, 1:31 pm ]
Post subject:  Re: BBCode code question about image sizing

You probably already know this. I find that Windows' Snipping Tool works great. I view any picture any size I want on the screen with any program I want to use for viewing. Then I open the Snipping tool, and draw a window around what you want to upload on the screen. You can even crop out what you don't want. Save the new photo and then upload it. It comes in to the site at the same size you viewed it when you saved the picture. It would be great if you could just copy it to the clipboard and then paste it into the "post a reply" window, or click and drag, but we are only 32 years into PC computing and usefull things like that take a bit of time. :cheers:

Author:  TooBusy [ February 18, 2013, 1:35 pm ]
Post subject:  Re: BBCode code question about image sizing

nick47 wrote:
I wrote the forum for our Miata group, and it auto-resizes photos. If I can do it, it's not that tricky.


Do you have some PHP bb3 code you can share? I'd like to be able to add this to my fishing forum. I've tried a bunch of things and can't get it to work.

Author:  nick47 [ February 18, 2013, 2:07 pm ]
Post subject:  Re: BBCode code question about image sizing

The code for resizing is just javascript:
Code:
function resizeImg(imgid)
{
   var maxwidth=800;
   imgobj=document.getElementById(imgid);
   if (imgobj.width>maxwidth)
   {
      imgobj.alt="Note: Photo has been resized from "+imgobj.width+" pixels by "+imgobj.height+" pixels to fit this space. Click to see full size.";
      imgobj.height = Math.round(imgobj.height*maxwidth/imgobj.width);
      imgobj.width  = maxwidth;
   }
}

You call this function in the onload event of the image tag:

<img src="..." id="img1" onload="resizeImg('img1')">

Author:  TooBusy [ February 18, 2013, 2:09 pm ]
Post subject:  Re: BBCode code question about image sizing

Thanks Nick. I'm going to attempt to embed that in the background of my fishing forum.

Author:  erioshi [ February 18, 2013, 11:04 pm ]
Post subject:  Re: BBCode code question about image sizing

All good responses, and stuff I'd come across while researching this. But it still doesn't address user-level BBCode to downsize an image to fit the browser width. I guess for now I'll assume there isn't a practical solution.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/