Commit 42b46074 authored by shiyu's avatar shiyu

图片旋转2

parent a893a80f
...@@ -15,6 +15,8 @@ import com.wwdz.ch.core.consts.CommConsts; ...@@ -15,6 +15,8 @@ import com.wwdz.ch.core.consts.CommConsts;
import com.wwdz.ch.core.consts.MediaTypeEnum; import com.wwdz.ch.core.consts.MediaTypeEnum;
import com.wwdz.ch.db.dao.dts.DtsStorageDao; import com.wwdz.ch.db.dao.dts.DtsStorageDao;
import com.xxdxxs.utils.CommonUtils; import com.xxdxxs.utils.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import com.wwdz.ch.core.util.CharUtil; import com.wwdz.ch.core.util.CharUtil;
...@@ -28,6 +30,8 @@ import static com.wwdz.ch.core.util.MediaUtil.bufferedImageToInputStream; ...@@ -28,6 +30,8 @@ import static com.wwdz.ch.core.util.MediaUtil.bufferedImageToInputStream;
* 提供存储服务类,所有存储服务均由该类对外提供 * 提供存储服务类,所有存储服务均由该类对外提供
*/ */
public class StorageService { public class StorageService {
private static final Logger logger = LoggerFactory.getLogger(StorageService.class);
private String active; private String active;
private com.wwdz.ch.core.storage.Storage storage; private com.wwdz.ch.core.storage.Storage storage;
...@@ -92,6 +96,7 @@ public class StorageService { ...@@ -92,6 +96,7 @@ public class StorageService {
} else { } else {
keyName = CommConsts.UPLOAD_PRE_DIRECTORY + CommonUtils.getUUID() + "_" + bufferedImage.getWidth() + "x" + bufferedImage.getHeight() + "." + type; keyName = CommConsts.UPLOAD_PRE_DIRECTORY + CommonUtils.getUUID() + "_" + bufferedImage.getWidth() + "x" + bufferedImage.getHeight() + "." + type;
} }
logger.info("上传图片 ============== rotation:{}, height:{}, width:{}", rotation, bufferedImage.getHeight(), bufferedImage.getWidth());
InputStream imageStream = bufferedImageToInputStream(bufferedImage, type); InputStream imageStream = bufferedImageToInputStream(bufferedImage, type);
storage.store(imageStream, contentLength, contentType, keyName); storage.store(imageStream, contentLength, contentType, keyName);
return generateUrl(keyName); return generateUrl(keyName);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment