Package de.xima.fc.form.common.upload
Class XUploadContentTransformer
- java.lang.Object
-
- de.xima.fc.form.common.upload.XUploadContentTransformer
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static IUploadPostProcessorcreateImagePostProcessor(Integer targetWidth, Integer targetHeight, String targetImgFormat, Double targetQuality, Path tmpDir, Consumer<String> protocolHandler)Deprecated.UseImageUploadProcessorinstead, which also removes the metadata of the image and which can be used without compressing the image at all.static IXUploadtransformXUpload(IXUpload upload, List<IUploadPostProcessor> postProcessors)Transforms the content of the given upload.
-
-
-
Method Detail
-
transformXUpload
public static IXUpload transformXUpload(IXUpload upload, List<IUploadPostProcessor> postProcessors) throws IOException
Transforms the content of the given upload. For example, the form designer offers users an option where they can specify that images should be compressed on the server before being stored.- Parameters:
upload- The content to transform.postProcessors- the chain of postprocessors to be applied (in the given order)- Returns:
- The transformed content, which is
- identical to the passed one if no postprocessing has been applied
nullif the passed upload itself or one of the postprocessing results isnull- a new
IXUploadinstance with the new content if the postprocessing chain was executed successfully
- Throws:
IOException
-
createImagePostProcessor
@Deprecated(since="8.6.0") public static IUploadPostProcessor createImagePostProcessor(Integer targetWidth, Integer targetHeight, String targetImgFormat, Double targetQuality, Path tmpDir, Consumer<String> protocolHandler)
Deprecated.UseImageUploadProcessorinstead, which also removes the metadata of the image and which can be used without compressing the image at all. Note that the postprocessor returned here now removes the metadata as well, as it is the very same postprocessor.Creates a postprocessor that compresses uploaded images.- Parameters:
targetWidth- Width the image should be scaled down to, ornullwhen the width does not matter.targetHeight- Height the image should be scaled down to, ornullwhen the height does not matter.targetImgFormat- Format the image should be converted to, orautoto keep its format.targetQuality- Quality (between 0 and 100) the image should be stored with.tmpDir- Directory to store the processed image in until it has been read.protocolHandler- Accepts the i18n keys of the messages to add to the form record's history.- Returns:
- The postprocessor for uploaded images.
-
-