XF 2.2 Resize linked images in threads

nopitter

New member
Hi,

what i want to do is: automatic resize (the view of) linked images in threads.

I want to fix the maximum width. Bigger images should be resized, smaller images should not be touched.
General behavior should not be changed, so responsive layout should work as by default.

Skin is the standard skin.

After reading a lot and trying even more, i ended up with the following code in extra.less:

Code:
.message-body
{
  width: 100% !important;
  max-width: 1024px !important;
  height: auto;
}

That works - even I do not understand exactly what I am doing, its stolen from a css info website ;) - but I have some questions.

1. Is message-body the correct class? Or should I use the bbImage class? What's the difference in this scenario?

2. I also tried other code mentioned here in the forums e.g. like

Code:
      .message-body img
      {
      max-height: 800px !important;
      max-width: 100% !important;
      }

I have noticed, that this works in my browsers with a window opened in "normal" size on my PC. Scaled the browser window smaller to smartphone-like aspect ratio, you will get an slider; scaling does not work as I want it.

Why? ;)

3. Is there a better solution, than the code I am using. As you can see, i do not know about css and I do not want to break anything.

Thanks for your help!

Peter
 
  • Like
Reactions: CVN

mAthosalas

Member
Same issue here.I'm wonder if it could someway automatically resize the images uploading to the forum from a link like Imgur.I'd like it to uploading with a maximum resolution 1920X1080 at forum..Is that possible?
 
  • Like
Reactions: CVN

nopitter

New member
Same issue here.I'm wonder if it could someway automatically resize the images uploading to the forum from a link like Imgur.I'd like it to uploading with a maximum resolution 1920X1080 at forum..Is that possible?

What do you mean, "uploading" and "resize"?

If you want to limit the size of linked images; that's what the code in extra.less is for. The original image size remains untouched. It is only for the view within a thread.

If you want to resize images in term of resolution, filesize - you have to process the original file. That can be done with attachements, xenforo gallery. Or via plugin, which stores a copy of all linked images on your own server (what I do not want to do because of copyright issues here in Germany/EU).

Peter
 
Last edited:
Top