Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
What's the best practice for image resizing?
r0obert
✭
v2.1
Images are breaking the comment div, what's the best solution for this issue?
Thanks!
Tagged:
0
Best Answer
-
hgtonight MVP
I figured it out. The bootstrap theme is missing the needed CSS rule. It needs the following rules:
.Message img { max-width: 100%; }
Perhaps @Kasper can confirm?
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
5
Answers
Are you using a custom theme?
The default js will resize images in the message list and add a link to the original full size image.
Is this not the case on your forum?
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight No, it's not the case for me it seems. Big images always break the container. I'm using Bootstrap theme.
Is there a global.js file being loaded in your head element?
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
This?
<script src="/js/global.js?v=2.1" type="text/javascript"></script>
Global.js
Go to the page where the images aren't resized. Right click on the page and select View Page source. Once that opens, hit Ctrl+f and type in
global.js
and see if it is found.Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Yes.
<script src="/js/global.js?v=2.1" type="text/javascript"></script>
Do you have any errors in your web console?
Ctrl+Shift+K opens it in Firefox. Once open, reload the page.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Use of getPreventDefault() is deprecated. Use defaultPrevented instead. jquery.min.js:3
Under any of these images, do you see a resized message?
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Unfortunately no, not a single resized image in any thread. What's the issue?
I figured it out. The bootstrap theme is missing the needed CSS rule. It needs the following rules:
Perhaps @Kasper can confirm?
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
I can indeed confirm—responsive images is a separate component in Bootstrap and it seems I've forgotten to implement it. Fix coming right up!
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
Excellent. Working!! Thanks a ton, so easy, so smooth...
Actually that's the first thing I've done, add the css rule, unfortunately for me I'm a n00b and I've added .Comment .Message img { width: xxx height: auto; } pfff...