如何解决如何在不压缩或拉伸图像的情况下将Potrait和风景图像设置为相同大小
我正在开发一个React应用程序,但是我面临着在不压缩图像的情况下将图像调整为相同大小的困难。我正在使用MD-bootstrap进行反应。有些图像是人像,有些是风景,问题只在肖像上出现。
<MDBCard className="my-5 px-5 pb-5">
<MDBCardBody className="text-center">
<h2 className="h1-responsive font-weight-bold text-center my-5">
Recent posts
</h2>
<p className="text-center w-responsive mx-auto mb-5">
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident,sunt in culpa qui officia deserunt mollit anim id est
laborum.
</p>
<MDBRow>
<MDBCol lg="4" md="12" className="mb-lg-0 mb-4">
<MDBView hover className="rounded z-depth-2 mb-4" waves style={{}}>
<img
className="img-fluid"
style={{
width: "400px",height: "230px",backgroundSize: "cover",backgroundRepeat: "noRepeat",backgroundPosition: "50% 50%",}}
src={props.post.postImage}
alt=""
/>
<MDBMask overlay="white-slight" />
</MDBView>
<a href="#!" className="pink-text">
<h6 className="font-weight-bold mb-3">
<MDBIcon icon="map" className="pr-2" />
{props.post.title}
</h6>
</a>
<h4 className="font-weight-bold mb-3">
<strong></strong>
</h4>
<p>
by{" "}
<a href="#!" className="font-weight-bold">
Billy Forester
</a>,15/07/2018
</p>
<p className="dark-grey-text">
{props.post.description.substring(0,200)}
</p>
<MDBBtn color="pink" rounded size="md">
Read more
</MDBBtn>
</MDBCol>
</MDBRow>
</MDBCardBody>
您可以看到我如何调整它们的大小,但是人像图像正在压缩,只有风景图像仍然具有实际质量。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。