Calgarypuck Forums - The Unofficial Calgary Flames Fan Community

Go Back   Calgarypuck Forums - The Unofficial Calgary Flames Fan Community > Miscellaneous > Help/Suggestions
Register Forum Rules FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread
Old 07-25-2014, 07:59 AM   #1
getbak
Franchise Player
 
getbak's Avatar
 
Join Date: Feb 2006
Location: Calgary, AB
Exp:
Default The problem with huge images

Every so often, someone posts an image that is massive and it screws up the format of the whole page.

I've been updating my own website and have added this simple style to my CSS so that images don't screw up page formatting on smaller screens. Images display at their normal size up to the point that they exceed the width of their container, then they shrink to stay contained.

Code:
img {
	max-width: 100%;
	height: auto;
}
Adding this to the forum's CSS should prevent those big images from screwing up the page. It won't prevent people from posting them, and it won't save the bandwidth used to download them, but at least it will stop pages from being thrown out of whack by them.

I assume you have some ability to edit the forum's CSS, and this would be a very simple edit that won't add any burden to the page and doesn't require any plugins or Javascript.
__________________
Turn up the good, turn down the suck!
getbak is offline   Reply With Quote
Old 07-25-2014, 11:06 AM   #2
Mazrim
CP Gamemaster
 
Mazrim's Avatar
 
Join Date: Feb 2010
Location: The Gary
Exp:
Default

Alternately, is there also a way to let the large image only stretch that one post, and the rest retain the original size? Skyscraperpage does that and it's great.
Mazrim is offline   Reply With Quote
Old 07-25-2014, 02:10 PM   #3
photon
The new goggles also do nothing.
 
photon's Avatar
 
Join Date: Oct 2001
Location: Calgary
Exp:
Default

Not with this forum software AFAIK Mazrim, or at least not without a much different template.

That's a good suggestion getbak, is there any potential downside? I can't think of any other than if there was something integral to the operation of the site that required images wider than the browser window but I don't think there are.
__________________
Uncertainty is an uncomfortable position.
But certainty is an absurd one.
photon is offline   Reply With Quote
Old 07-25-2014, 02:13 PM   #4
getbak
Franchise Player
 
getbak's Avatar
 
Join Date: Feb 2006
Location: Calgary, AB
Exp:
Default

I don't believe there should be any downside. All images will display normally, this will just restrict those super-big ones from stretching too far. Since it's just CSS, it shouldn't have any impact on any other functions on the forum.
__________________
Turn up the good, turn down the suck!
getbak is offline   Reply With Quote
Old 07-25-2014, 02:26 PM   #5
photon
The new goggles also do nothing.
 
photon's Avatar
 
Join Date: Oct 2001
Location: Calgary
Exp:
Default

Tried it and it fixes the big images, but for some reason it makes the icons in the editor disappear, so I reverted.
__________________
Uncertainty is an uncomfortable position.
But certainty is an absurd one.
photon is offline   Reply With Quote
Old 07-25-2014, 03:13 PM   #6
getbak
Franchise Player
 
getbak's Avatar
 
Join Date: Feb 2006
Location: Calgary, AB
Exp:
Default

Ah, those images are in table cells without a defined width, so the max-width screws them up.

Try this:
Code:
.alt1 img {
	max-width: 100%;
}
That will only affect images in the message display fields. I tested it in Chrome and it seems to work without affecting the icons.
__________________
Turn up the good, turn down the suck!
getbak is offline   Reply With Quote
Old 07-25-2014, 03:22 PM   #7
photon
The new goggles also do nothing.
 
photon's Avatar
 
Join Date: Oct 2001
Location: Calgary
Exp:
Default

Yeah seems to work.

http://forum.calgarypuck.com/showthr...wpost&t=138755
__________________
Uncertainty is an uncomfortable position.
But certainty is an absurd one.
photon is offline   Reply With Quote
Old 07-25-2014, 03:25 PM   #8
getbak
Franchise Player
 
getbak's Avatar
 
Join Date: Feb 2006
Location: Calgary, AB
Exp:
Default

Woohoo!
__________________
Turn up the good, turn down the suck!
getbak is offline   Reply With Quote
Old 07-25-2014, 03:54 PM   #9
getbak
Franchise Player
 
getbak's Avatar
 
Join Date: Feb 2006
Location: Calgary, AB
Exp:
Default

I noticed a couple of places where images have also disappeared because they're in td tags with the alt1 class and undefined width...
  • The Ivrnet logo at the top, and the "thread status icon" cell (the leftmost cell on the topics page) are both in cells with the "alt1" class but no defined size, so they disappear too.

  • You could fix that either by changing the class on those cells to "alt2" (which seems to look exactly the same as "alt1"), or put a defined size on the img tags or the td cell.

I don't know how much control you have in editing those things.
__________________
Turn up the good, turn down the suck!
getbak is offline   Reply With Quote
Old 07-25-2014, 04:24 PM   #10
photon
The new goggles also do nothing.
 
photon's Avatar
 
Join Date: Oct 2001
Location: Calgary
Exp:
Default

Good eyes, I took it back out for now. I might also be able to assign a class to the td cell for posts to reference that only, I'll have to look at the templates. I'll check it out.
__________________
Uncertainty is an uncomfortable position.
But certainty is an absurd one.
photon is offline   Reply With Quote
Old 07-26-2014, 06:04 AM   #11
Finger Cookin
Franchise Player
 
Finger Cookin's Avatar
 
Join Date: Jun 2014
Exp:
Default

Quote:
Originally Posted by photon View Post
That image still stretches the page for me in Chrome, FWIW.

EDIT: Whoops, looks like this is still a work in progress.
Finger Cookin is offline   Reply With Quote
Old 07-26-2014, 03:25 PM   #12
maverickstruth
Backup Goalie
 
maverickstruth's Avatar
 
Join Date: Mar 2006
Location: Calgary
Exp:
Default

What about using a CSS3 attribute selector, like so:

Code:
div[id^=post_message_] img { max-width: 100%; height: auto; }
(If you're not familiar with the syntax, this only targets divs with an ID of the form post_message_XXXX, regardless of what the numeric string is on the end of the ID).

Should work in all modern browsers, and even in IE7+. IE6 would be left in the cold, but it would be no worse for those users than it is at present.
maverickstruth is offline   Reply With Quote
The Following User Says Thank You to maverickstruth For This Useful Post:
Old 07-27-2014, 11:16 AM   #13
photon
The new goggles also do nothing.
 
photon's Avatar
 
Join Date: Oct 2001
Location: Calgary
Exp:
Default

That seems to work. I assume there's some kind of performance impact from using an attribute selector, but I also assume since we're only using one it probably isn't worth thinking about.
__________________
Uncertainty is an uncomfortable position.
But certainty is an absurd one.
photon is offline   Reply With Quote
The Following User Says Thank You to photon For This Useful Post:
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 11:54 AM.

Calgary Flames
2024-25




Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright Calgarypuck 2021 | See Our Privacy Policy