|
@@ -117,7 +117,7 @@ public class CommonUtil {
|
|
public static synchronized InputStream getOSSInputStream(String urlStr) throws Exception {
|
|
public static synchronized InputStream getOSSInputStream(String urlStr) throws Exception {
|
|
//获取OSS文件流
|
|
//获取OSS文件流
|
|
if(urlStr!=null && urlStr.indexOf("183.247.216.148:9000")>=0){// nimio 甬台温 本地部署修改
|
|
if(urlStr!=null && urlStr.indexOf("183.247.216.148:9000")>=0){// nimio 甬台温 本地部署修改
|
|
- urlStr = urlStr.replace("https:","http:").replace("183.247.216.148:9000","152.168.2.15:9000");
|
|
|
|
|
|
+ urlStr = urlStr.replace("https://","http://").replace("183.247.216.148","152.168.2.15").replace(":9000//",":9000/");
|
|
}
|
|
}
|
|
URL url =new URL(urlStr);
|
|
URL url =new URL(urlStr);
|
|
final URLConnection conn = url.openConnection();
|
|
final URLConnection conn = url.openConnection();
|
|
@@ -493,7 +493,7 @@ public class CommonUtil {
|
|
* @throws MetadataException
|
|
* @throws MetadataException
|
|
*/
|
|
*/
|
|
|
|
|
|
- public static void main(String[] args) throws IOException, ImageProcessingException, MetadataException {
|
|
|
|
|
|
+/* public static void main(String[] args) throws IOException, ImageProcessingException, MetadataException {
|
|
String imgurl = "/Users/hongchuangyanfa/Desktop/excel/7777.jpg";
|
|
String imgurl = "/Users/hongchuangyanfa/Desktop/excel/7777.jpg";
|
|
File file = ResourceUtils.getFile(imgurl);
|
|
File file = ResourceUtils.getFile(imgurl);
|
|
byte[] bytes = InputStreamToBytes(new FileInputStream(file));
|
|
byte[] bytes = InputStreamToBytes(new FileInputStream(file));
|
|
@@ -509,7 +509,7 @@ public class CommonUtil {
|
|
ImageIO.write(image, "png", outputFile);
|
|
ImageIO.write(image, "png", outputFile);
|
|
|
|
|
|
System.out.println("图片转换并保存成功!");
|
|
System.out.println("图片转换并保存成功!");
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
public static byte[] compressImage(byte[] imageData) throws IOException, ImageProcessingException, MetadataException {
|
|
public static byte[] compressImage(byte[] imageData) throws IOException, ImageProcessingException, MetadataException {
|
|
// 读取原始图像(处理旋转问题)
|
|
// 读取原始图像(处理旋转问题)
|
|
@@ -646,7 +646,7 @@ public class CommonUtil {
|
|
//本地部署- 甬台温
|
|
//本地部署- 甬台温
|
|
if (url.indexOf("183.247.216.148")>=0) {
|
|
if (url.indexOf("183.247.216.148")>=0) {
|
|
// 如果当前环境变量不包含linuxtesttest,则替换URL中的oss路径
|
|
// 如果当前环境变量不包含linuxtesttest,则替换URL中的oss路径
|
|
- url = url.replace("https://","http://").replace("183.247.216.148:9000","152.168.2.15:9000");
|
|
|
|
|
|
+ url = url.replace("https://","http://").replace("183.247.216.148","152.168.2.15").replace(":9000//",":9000/");
|
|
}
|
|
}
|
|
return url;
|
|
return url;
|
|
}
|
|
}
|