|
|
|
@@ -18,6 +18,7 @@ import com.iformall.utils.Constant; |
|
|
|
import com.iformall.utils.ImgUtil; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@@ -173,9 +174,8 @@ public class UploadController extends BaseController { |
|
|
|
System.out.println(fileName); |
|
|
|
|
|
|
|
FileOutputStream fos = null; |
|
|
|
if(fileFormat.equalsIgnoreCase(".jpg") |
|
|
|
|| fileFormat.equalsIgnoreCase(".jpeg") |
|
|
|
|| fileFormat.equalsIgnoreCase(".png")) { |
|
|
|
String imgFormat = ImgUtil.getImgFormat(fileFormat); |
|
|
|
if(StringUtils.isNotBlank(imgFormat)) { |
|
|
|
String localImgFileName = Constant.fileDirectory + File.separator + tempFileName + fileFormat; |
|
|
|
String tempFileName1 = UUID.randomUUID().toString(); |
|
|
|
String localNewImgFileName = Constant.fileDirectory + File.separator + tempFileName1 + fileFormat; |
|
|
|
@@ -192,7 +192,7 @@ public class UploadController extends BaseController { |
|
|
|
fs.close(); |
|
|
|
logger.info("local file: " + localImgFileName); |
|
|
|
|
|
|
|
File newFile = ImgUtil.thinImage(localImgFileName, localNewImgFileName); |
|
|
|
File newFile = ImgUtil.thinImage(localImgFileName, localNewImgFileName, imgFormat); |
|
|
|
logger.info("local new file: " + localImgFileName); |
|
|
|
// 删除本地缓存 |
|
|
|
localFile.delete(); |
|
|
|
|