根据原图,计算一个宽或高最大100的图片的计算方法

 const previewImageRatio = previewImageWidth / previewImageHeight; // 原图宽高比例
                        let thumbnailHeight,thumbnailWidth;// 缩略图高和宽
                        if(previewImageRatio > 1){
                            thumbnailWidth = 100; // 缩略图宽度固定为 100
                            thumbnailHeight = thumbnailWidth / previewImageRatio;
                        }else{
                            thumbnailHeight = 100;
                            thumbnailWidth = thumbnailHeight * previewImageRatio;
                        }

  

posted @ 2024-03-21 17:09  怪咖咖  阅读(17)  评论(0编辑  收藏  举报