ImageFileService

In order to init ImageFileService need to use - Imcms.getServices().getManagedBean(ImageFileService.class)

Use API

List<ImageFileDTO> saveNewImageFiles(String folder, List<MultipartFile> files) throws IOException;

List<ImageFileUsageDTO> deleteImage(ImageFileDTO imageFileDTO) throws IOException;

List<ImageFileUsageDTO> getImageFileUsages(String imageFileDTOPath);

Description how convert file to MockMultipartFile

String name = "testFile";
String originalName = "img-test.jpg";
String contentType = null;
byte[] content = Files.readAllBytes(new File(pathName..).toPath());

MockMultipartFile file = new MockMultipartFile("file", "img1-test.jpg", null, content);

Description fields in ImageFileDTO

  1. String name;

  2. String path;

  3. Format format;

  4. String uploaded; - lastModifiedDate

  5. String resolution;

  6. String size;

  7. Integer width;

  8. Integer height

Description fields ImageFileUsageDTO

  1. Integer docId;

  2. Integer version;

  3. Integer elementIndex;

  4. String comment;