######选择本地图片预览时。等比例缩放图片。【查了各种js不行。最后想到换种方式,用css! ok!】

######选择本地图片预览时。等比例缩放图片。【查了各种js不行。最后想到换种方式,用css! ok!】

找到:https://blog.csdn.net/forrest_chen/article/details/52210093

=======

yes!

=====我的实现:【项目中用到的,上传图片素材,要实现:保持图片等比例 缩放预览。】

找了3个多小时!!!换种思路:ok

 <div  style="max-width: 400px; float: left;">
                                    <span style="margin-left: 15px">引流素材<font color="red">*</font></span>
                                   <%-- 新建的时候adslotDO.id == null 素材才是必填的。--%>
                                    <input id="filed" name="originMaterialFile" type="file"  accept="image/*,application/pdf" class="ipt cc-input"  <c:if test="${adslotDO.id == null}">required</c:if>  /><br/>
                                    <%-- 编辑的时候adslotDO.id != null 不是必填的。ccAdslotMapper.updateByPrimaryKeySelective(record);就不更新materialUrl。。不需要hidden提交materialUrl--%>

                                    <span style="margin-left: 15px;margin-top: 10px;">第三方广告位ID<font color="red">*</font></span>
                                    <input type="text" name="slotId" value="${adslotDO.slotId}"  class="ipt cc-input" style="margin-top: 10px"   required   />
                                </div>

                                <%--显示的图片。--%>
                               <%-- img{
                                width: auto;
                                height: auto;
                                max-width: 100%;
                                max-height: 100%;
                                }--%>

                                <div style="width:390px;height:155px;float: left;margin-top: -41px;margin-left: 10px;    text-align: center">
                                    <img id="imgshow" src="${materialUrl}" style="width:auto;height:auto;max-width: 100%;max-height: 100%;float: left;margin-left:10px;   vertical-align: middle;" alt="">
                                </div>



======



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值