Best way to prevent oversized images in sidebar breaking layout
-
Hey, so I’m wondering what would be the best way to prevent a layout from breaking if a client inserts an oversized image in the sidebar.. For example, say we have a css rule:
.sidebar{
width: 300px;}
Then the client puts an image of 2000px in a post, and they think the site is broken..
Was thinking overflow hidden would solve the break, but they’d still think it’s “broken..” So I’m really thinking some kind of conditional, would nail it, but I don’t really know how I could write this..
something like:
on post load that includes an image..
if(“image-width” > 300px;){make it smaller than 300px, or display a thumbnail..}
any chance someone could write such a function?
- The topic ‘Best way to prevent oversized images in sidebar breaking layout’ is closed to new replies.