简体   繁体   中英

uploading image using ngf-resize in Cloudinary

Generating an image URL using ngf-resize in Cloudinary.

<div id="direct_upload"
    ngf-drop="uploadFiles($file)"
    ngf-resize="{width: 500, height:200, quality: 1.0}" 
    ng-model="file">
 </div>

but response from Cloudinary returning different width and height.

在此处输入图片说明

The resize will keep the aspect ratio of the image so one of the width or height will be the value in the resize and the other one would be smaller unless the photo is exactly at the same aspect ratio as 5X2.

If you want to lose part of the image and center crop it you can do

ngf-resize="{width: 500, height:200, centerCrop: true}" 

This will make the image of the exact size but will cut part of the image either horizontally or vertically.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM