If you build websites that let users upload avatars or image and you wondered how facebook maintain that ratio for images? here is a css snippet that knows how to keep your avatars at ratio scaled to any size:
.avatar img
{
float:left;
vertical-align:middle;
margin-left:0px;
border: solid 1px #CCCCCC;
top:50%;
max-width:60px;
width: expression(this.width > 60 ? 60: true);
max-height:65px;
height: expression(this.width > 70 ? 70: true);
}
You can change the max width and height accordingly and change the width expression and the height expression to match it. works wonderful.
- BROWSE / IN TIMELINE
- « Build your own Video streaming community for 0$
- » Cutting text , handy php function
- BROWSE / IN design web savvy software
- « Build your own Video streaming community for 0$
- » Cutting text , handy php function
COMMENTS / ONE COMMENT
TIm added these pithy words on Jan 07 08 at 2:52 amsorry, but this is shitty method - it has 2 major flaws: 1 - using expressions in css, 2 - this scaling method trashes images. when i had to display various size thumbs, php & gd was a solution, and btw Facebook uses different size thumbnails scaled after you upload it, they dont stretch/shrink images like you show.
SPEAK / ADD YOUR COMMENT
Comments are moderated.
