思路:
针对获取原信息中含有(orientation)参数,值为Right-top和Left-bottom会被旋转:
{"size":1640252,"format":"jpeg","width":3456,"height":2304,"colorModel":"ycbcr","orientation":"Left-bottom"}
方法一:?imageView2/0/format/jpg,给图片统统加后缀(简单粗暴)
方法二:?imageMogr2/auto-orient,通过判断orientation,加此后缀,防止放入img标签图片转向:
js处理思路如下(java同理):
function getImageFormat(key) {
var img = "";
$.ajax({
type: "get",
async : true,
dataType: "json",
url: imagePrefix+key+"?imageInfo",
success: function (data) {
var orientation = data.orientation;
if(typeof(orientation) != "undefined"){
if(orientation == "Right-top" || orientation == "Left-bottom"){
img = imagePrefix+key+"?imageMogr2/auto-orient";
//或者img = imagePrefix+key+"?imageView2/0/format";
}
}
}
});
}