类 UploadHandler
java.lang.Object
cloud.opencode.base.tool.upload.UploadHandler
- 版本:
- v1.0.0
- 作者:
- Jon So, e-mail: ijonso123@gmail.com url: Jon's blog url: project github
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明private static StringdownloadImage(String urlString) Download file from webgetPosition(WatermarkPosition position, int marginX, int marginY, int imgWidth, int imgHeight, int iconWidth, int iconHeight) get watermark positionprivate StringgetSuffix(org.springframework.web.multipart.MultipartFile file) Get multipartFile suffixprivate InputStreamhandleImage(Image image, WatermarkType waterType, WatermarkText waterText, WatermarkImage waterImage) Handle image with watermarkupImage(org.springframework.web.multipart.MultipartFile file, String savePath, OssDirectParam param) Upload image without watermark Ali OSS direct uploadupImageBase(InputStream inputStream, String savePath, WatermarkType waterType, WatermarkText waterText, WatermarkImage waterImage, OssDirectParam param) Upload image (without check image type) Ali OSS direct uploadupImageBase(org.springframework.web.multipart.MultipartFile file, String savePath, WatermarkType waterType, WatermarkText waterText, WatermarkImage waterImage, OssDirectParam param) Upload image Ali OSS direct uploadupImageWithWatermarkImage(org.springframework.web.multipart.MultipartFile file, String savePath, WatermarkImage image, OssDirectParam param) Upload image with image watermark Ali OSS direct uploadupImageWithWatermarkText(org.springframework.web.multipart.MultipartFile file, String savePath, WatermarkText text, OssDirectParam param) Upload image with text watermark Ali OSS direct uploadprivate Stringupload(byte[] data, String savePath, OssDirectParam ossParam) Upload fileprivate Stringupload(InputStream inputStream, String savePath, OssDirectParam ossParam) Upload fileprivate Stringupload(org.springframework.web.multipart.MultipartFile file, String savePath, OssDirectParam ossParam) Upload fileuploadFile(byte[] data, String savePath, OssDirectParam param) Upload file to specify directory Ali OSS direct uploaduploadFile(InputStream inputStream, String savePath, OssDirectParam param) Upload file to specify directory Ali OSS direct uploaduploadFile(org.springframework.web.multipart.MultipartFile file, OssDirectParam param) Upload file to root directory.uploadFile(org.springframework.web.multipart.MultipartFile file, String savePath, OssDirectParam param) Upload file to specify directory Ali OSS direct upload
-
构造器详细资料
-
UploadHandler
public UploadHandler()
-
-
方法详细资料
-
getPosition
private static Map<String,Integer> getPosition(WatermarkPosition position, int marginX, int marginY, int imgWidth, int imgHeight, int iconWidth, int iconHeight) get watermark position- 参数:
position- positionmarginX- margin xmarginY- margin yimgWidth- image widthimgHeight- image heighticonWidth- watermark widthiconHeight- watermark height- 返回:
- map
-
downloadImage
Download file from web- 参数:
urlString- URLs that begin with http or https- 返回:
- local path
- 抛出:
IOException
-
uploadFile
public String uploadFile(org.springframework.web.multipart.MultipartFile file, OssDirectParam param) throws Exception Upload file to root directory. Ali OSS direct upload- 参数:
file- fileparam- OSS param- 返回:
- The full url after the upload is complete
- 抛出:
Exception
-
uploadFile
public String uploadFile(org.springframework.web.multipart.MultipartFile file, String savePath, OssDirectParam param) throws Exception Upload file to specify directory Ali OSS direct upload- 参数:
file- filesavePath- The name of the saved file, without the first '/'param- OSS param- 返回:
- The full url after the upload is complete
- 抛出:
Exception
-
uploadFile
public String uploadFile(InputStream inputStream, String savePath, OssDirectParam param) throws Exception Upload file to specify directory Ali OSS direct upload- 参数:
inputStream- file inputStreamsavePath- The name of the saved file, without the first '/'param- OSS param- 返回:
- The full url after the upload is complete
- 抛出:
Exception
-
uploadFile
Upload file to specify directory Ali OSS direct upload- 参数:
data- file byte[] datasavePath- The name of the saved file, without the first '/'param- OSS param- 返回:
- The full url after the upload is complete
- 抛出:
Exception
-
upImageBase
public String upImageBase(org.springframework.web.multipart.MultipartFile file, String savePath, WatermarkType waterType, WatermarkText waterText, WatermarkImage waterImage, OssDirectParam param) throws Exception Upload image Ali OSS direct upload- 参数:
file- filesavePath- The name of the saved image, without the first '/' . ex: 20220202/001.jpgwaterType- watermark typewaterText- watermark for textwaterImage- watermark for imageparam- oss param- 返回:
- The full url after the upload is complete
- 抛出:
Exception
-
upImageBase
public String upImageBase(InputStream inputStream, String savePath, WatermarkType waterType, WatermarkText waterText, WatermarkImage waterImage, OssDirectParam param) throws Exception Upload image (without check image type) Ali OSS direct upload- 参数:
inputStream- image file inputStream.savePath- The name of the saved image, without the first '/' . ex: 20220202/001.jpgwaterType- watermark typewaterText- watermark for textwaterImage- watermark for imageparam- oss par- 返回:
- The full url after the upload is complete
- 抛出:
Exception
-
upImageWithWatermarkImage
public String upImageWithWatermarkImage(org.springframework.web.multipart.MultipartFile file, String savePath, WatermarkImage image, OssDirectParam param) throws Exception Upload image with image watermark Ali OSS direct upload- 参数:
file- filesavePath- The name of the saved image, without the first '/' . ex: 20220202/001.jpgimage- watermark imageparam- oss param- 返回:
- The full url after the upload is complete
- 抛出:
Exception
-
upImageWithWatermarkText
public String upImageWithWatermarkText(org.springframework.web.multipart.MultipartFile file, String savePath, WatermarkText text, OssDirectParam param) throws Exception Upload image with text watermark Ali OSS direct upload- 参数:
file- filesavePath- The name of the saved image, without the first '/' . ex: 20220202/001.jpgtext- watermark textparam- oss param- 返回:
- The full url after the upload is complete
- 抛出:
Exception
-
upImage
public String upImage(org.springframework.web.multipart.MultipartFile file, String savePath, OssDirectParam param) throws Exception Upload image without watermark Ali OSS direct upload- 参数:
file- image filesavePath- The name of the saved image, without the first '/' . ex: 20220202/001.jpgparam- oss param- 返回:
- The full url after the upload is complete
- 抛出:
Exception
-
handleImage
private InputStream handleImage(Image image, WatermarkType waterType, WatermarkText waterText, WatermarkImage waterImage) throws Exception Handle image with watermark- 参数:
image- original imagewaterType- watermark typewaterText- watermark for textwaterImage- watermark for image- 返回:
- InputStream
- 抛出:
Exception
-
getSuffix
Get multipartFile suffix- 参数:
file-- 返回:
- file suffix
-
upload
Upload file- 参数:
data- byte[]savePath- the file save pathossParam- oss param- 返回:
- The full url after the upload is complete
-
upload
Upload file- 参数:
inputStream- file inputStreamsavePath- the file save pathossParam- oss param- 返回:
- The full url after the upload is complete
-
upload
private String upload(org.springframework.web.multipart.MultipartFile file, String savePath, OssDirectParam ossParam) throws IOException Upload file- 参数:
file- multipartFilesavePath- the file save pathossParam- oss param- 返回:
- The full url after the upload is complete
- 抛出:
IOException
-