how to set display size of images in forum posts?

Off-topic posts of interest to the "Everything" community.
Post Reply
jimspoon
Posts: 56
Joined: Tue Apr 26, 2011 11:39 pm

how to set display size of images in forum posts?

Post by jimspoon » Sat Oct 09, 2021 3:59 pm

Is there a way to control the display size of images included in posts on this forum?
I've tried including "size=" and "width=" parameters in the
[img]
tag but nothing worked.

horst.epp
Posts: 559
Joined: Fri Apr 04, 2014 3:24 pm

Re: how to set display size of images in forum posts?

Post by horst.epp » Sat Oct 09, 2021 4:29 pm

I do that while creating the images, a screen shot tool or other image tool
and not in the forum.

NotNull
Posts: 3196
Joined: Wed May 24, 2017 9:22 pm

Re: how to set display size of images in forum posts?

Post by NotNull » Sat Oct 09, 2021 8:17 pm

jimspoon wrote:
Sat Oct 09, 2021 3:59 pm
Is there a way to control the display size of images included in posts on this forum?
I've tried including "size=" and "width=" parameters in the
[img]
tag but nothing worked.
The [img] BBCodes (size, height, width) are not supported on this forum.

therube
Posts: 3127
Joined: Thu Sep 03, 2009 6:48 pm

Re: how to set display size of images in forum posts?

Post by therube » Mon Oct 11, 2021 5:06 pm

I'll assume that the board itself has some max height/width & automatically resizes larger images?
Otherwise you could host externally, either by link, or thumbnail hotlink.

Here, viewtopic.php?p=39882#p39882, the width is constrained.
(Right-click, View Image, to see the difference.)

NotNull
Posts: 3196
Joined: Wed May 24, 2017 9:22 pm

Re: how to set display size of images in forum posts?

Post by NotNull » Mon Oct 11, 2021 7:29 pm

therube wrote:
Mon Oct 11, 2021 5:06 pm
I'll assume that the board itself has some max height/width & automatically resizes larger images?
It hasn't. The shown size is limited by the "page" (the area where a post is displayed).

jimspoon
Posts: 56
Joined: Tue Apr 26, 2011 11:39 pm

Re: how to set display size of images in forum posts?

Post by jimspoon » Tue Oct 12, 2021 12:12 am

therube,

I looked at the source view for viewtopic.php?p=39882#p39882 - the img tag for that image begins "<img src="./download/file.php?id=1582" class="postimage"". So I looked for a reference to a "postimage" class. I think I found it in styles/prosilver/theme/content.css - as follows:
.postbody img.postimage {
max-width: 100%;
So I'm guessing that the max-width attribute is what sizes the images down to 100% of the frame width.

jimspoon
Posts: 56
Joined: Tue Apr 26, 2011 11:39 pm

Re: how to set display size of images in forum posts?

Post by jimspoon » Tue Oct 12, 2021 12:28 am

I found another way to change the display size of an image included in a post here. This post points to an image named Ya3fEfc.jpg on Imgur. If I add an "m" to the filename (Ya3fEfcm.jpg) to the url, Imgur will serve up a 320px width image to this forum (see below) - more info and options here - https://superuser.com/questions/1238552 ... mgur-image

Image

void
Site Admin
Posts: 7759
Joined: Fri Oct 16, 2009 11:31 pm

Re: how to set display size of images in forum posts?

Post by void » Tue Oct 12, 2021 3:27 am

I have added a imgwh bbcode.

Usage:

Code: Select all

[imgwh=width,height]Image URL[/imgwh]

32 x 32 Example:

Code: Select all

[imgwh=32,32]https://www.voidtools.com/everything.1.5.dark.mode2.png[/imgwh]




64 x 64 Example:

Code: Select all

[imgwh=64,64]https://www.voidtools.com/everything.1.5.dark.mode2.png[/imgwh]




128 x 128 Example:

Code: Select all

[imgwh=128,128]https://www.voidtools.com/everything.1.5.dark.mode2.png[/imgwh]




256 x 256 Example:

Code: Select all

[imgwh=256,256]https://www.voidtools.com/everything.1.5.dark.mode2.png[/imgwh]




512 x 512 Example:

Code: Select all

[imgwh=512,512]https://www.voidtools.com/everything.1.5.dark.mode2.png[/imgwh]




256 x 128 Example:

Code: Select all

[imgwh=256,128]https://www.voidtools.com/everything.1.5.dark.mode2.png[/imgwh]




Normal img Example:

Code: Select all

[img]https://www.voidtools.com/everything.1.5.dark.mode2.png[/img]
Image



The maximum width for this board is 860 pixels.

jimspoon
Posts: 56
Joined: Tue Apr 26, 2011 11:39 pm

Re: how to set display size of images in forum posts?

Post by jimspoon » Tue Oct 12, 2021 3:53 am

Great! Thanks.

therube
Posts: 3127
Joined: Thu Sep 03, 2009 6:48 pm

Re: how to set display size of images in forum posts?

Post by therube » Tue Oct 12, 2021 7:25 pm

(
Here, viewtopic.php?p=39882#p39882, the width is constrained.
Better had I said, "scaled", rather then, constrained.
)
I found another way to change the display size of an image included in a post here. This post points to an image named Ya3fEfc.jpg on Imgur. If I add an "m" to the filename (Ya3fEfcm.jpg) to the url, Imgur will serve up a 320px width image
Just to note, that is going to be specific to conventions used by a particular service.


Similarly, as services change over time, including their names (domains), you may be able to "resurrect" dead (hotlink'd) images (scary thought, but then Halloween is approaching) by adjusting the domain name (or parts thereof & also assuming the the file name part was carried over as it originally was).

jimspoon
Posts: 56
Joined: Tue Apr 26, 2011 11:39 pm

Re: how to set display size of images in forum posts?

Post by jimspoon » Tue Oct 12, 2021 10:25 pm

therube wrote:
Tue Oct 12, 2021 7:25 pm
Just to note, that is going to be specific to conventions used by a particular service.
That's right. I looked at a few other services to see if they supported serving up different versions of the same image based on alterations to the URL used to embed the image, and if so, how to do it.

OneDrive will generate different links for different versions of the same image. Google Drive and Dropbox seemed to make things a little more difficult. I looked at a couple of other image hosting services supported by my screenshot utility (ShareX) including Chevereto and vgy.me, which I had never heard of.

The odd thing is that Imgur and OneDrive only seem to support a few specific image sizes - you'd think you could edit the URL to specify an arbitrary image width (e.g. 300px) and that these services would generate that width on the fly, but that didn't work when I tried that with a OneDrive link. Maybe there is an image hoster that does support it, but I haven't found it yet. If anybody has found that, please pass along that info, would be useful.

jimspoon
Posts: 56
Joined: Tue Apr 26, 2011 11:39 pm

Re: how to set display size of images in forum posts?

Post by jimspoon » Wed Oct 13, 2021 4:16 am

Just experimenting with the new imgwh tag. You'll have to provide both width and height parameters - providing only a width parameter won't display an image. For the image below I just guessed that if I selected 300 as the width, the height should be about 200. It's probably not exactly the same as the original aspect ratio, but it's OK.


Post Reply