const previewImageRatio = previewImageWidth / previewImageHeight; // 原图宽高比例 let thumbnailHeight,thumbnailWidth;// 缩略图高和宽 if(previewImageRatio > 1){ thumbnailWidth = 100; // 缩略图宽度固定为 100 thumbnailHeight = thumbnailWidth / previewImageRatio; }else{ thumbnailHeight = 100; thumbnailWidth = thumbnailHeight * previewImageRatio; }
标签:原图,thumbnailWidth,缩略图,previewImageRatio,thumbnailHeight,100,计算方法 From: https://www.cnblogs.com/shark1100913/p/18087801