前端uniapp中获取图片宽高 并转换为mm

			uni.getImageInfo({
				src: "https://zjz-1254115331.cos.ap-beijing.myqcloud.com/20231128/656547269e5111701136166.jpg",
				success: function(image) {
					let getWindowInfo = uni.getWindowInfo()
					console.log("image", image);
					const mmWidth = (image.width / 300) * 25.4;
					const mmHeight = (image.height / 300) * 25.4;
					console.log("mmWidth", Math.round(mmWidth));
					console.log("mmHeight", Math.round(mmHeight));
				}
			});

你可能感兴趣的:(前端,uni-app)