如果我是你,我会使用CSS3来简化.下面将图像变成一个圆圈,并给它一个1px圆边框.
div.avatar{
width:30px; height:30px; border:solid 1px #000;
-webkit-border-radius: 16px; -moz-border-radius: 16px; border-radius: 16px;
}
div.avatar img{
width:30px; height:30px;
-webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px;
}
<div class="avatar"><img src="" /></div>
Run Code Online (Sandbox Code Playgroud)