我一直在搜寻,但是找不到适合我的情况的解决方案。
我正在尝试为此使用CSS解决方案,不幸的是,我不知道如何实现jquery,但是也许有人可以指出我正确的方向。

我以以下图像为例:http://pho.to/8rURy

这张图片很容易说明,我需要将图片居中,裁剪并调整为80px x 80px的缩略图

目前,我被困在以下CSS上:

/* Image container */
.profile-img {
width: 90px;
height: 90px;
margin-left: auto;
margin-right: auto;
text-align: center;
padding-top: 15px;
}

/* Image placed in the image container - there is a border around the image, but created as a background */
.profile-img img {
width: 80px;
height: 80px;
padding: 5px !important;
background: #fff !important;
border: none !important;
border-radius: 999px !important;
}


这里的问题是图像适合容器,但是图像被拉伸(准确地缩小了)以适合容器。

我需要一种可以按比例裁剪,居中和适合图像的解决方案。

有任何想法吗 ??

最佳答案

如果您使用的图像尺寸为80x80,则必须在该图像上使用以下类:

 .img-circle {

        border-radius:500px;
        -moz-border-radius:500px;
        -webkit-border-radius:500px;

        }


<img src="your image path" class="img-circle />"

关于php - 裁剪-缩放-将图像居中并调整为圆形缩略图,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28555696/

10-14 15:11
查看更多