java.lang.Object
de.agilecoders.wicket.extensions.markup.html.bootstrap.editor.SummernoteFileStorage
All Implemented Interfaces:
SummernoteStorage

public class SummernoteFileStorage extends Object implements SummernoteStorage
A File storage for the summer note editor.

Example:
 SummernoteStoredImageResourceReference:
 mountResource(SummernoteStoredImageResourceReference.SUMMERNOTE_MOUNT_PATH, new SummernoteStoredImageResourceReference("storageId"));

 Storage Initialization:
 SummernoteConfig.addStorage(new SummernoteFileStorage("storageId", new File("/Users/Someone")));

 Editor Config:
 SummernoteConfig summernoteConfig = new SummernoteConfig();
 summernoteConfig.useStorageId("storageId");
 
Result: Images are stored into /User/Someone/storageId/<imageName>

Author:
Tobias Soloschenko
  • Constructor Details

    • SummernoteFileStorage

      public SummernoteFileStorage(String id, File folder)
      Creates a file storage which stores the images into the given folder and subfolder of the given id
      Parameters:
      id - the id of the file storage which also is used as subfolder to store the images
      folder - the folder to store images
  • Method Details

    • getContent

      public byte[] getContent(String imageName)
      Gets image data form the file system
      Specified by:
      getContent in interface SummernoteStorage
      Parameters:
      imageName - the image name
      Returns:
      the image bytes
    • writeContent

      public void writeContent(String imageName, InputStream inputStream)
      Writes image data to the file system
      Specified by:
      writeContent in interface SummernoteStorage
      Parameters:
      imageName - the name of the image
      inputStream - the stream of the image
    • getId

      public String getId()
      Gets the id of the storage
      Specified by:
      getId in interface SummernoteStorage
      Returns:
      the id of the storage