package no.dusken.aranea.service; import no.dusken.aranea.model.Image; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; import java.net.URL; /** * @author Marvin B. Lillehaug <lillehau@underdusken.no> */ public interface StoreImageService { /** * Stores the file in the multipartFile on the server and return the * {@link Image} object to represent it. * @param mFile the file to be stored. * @return the {@link Image} that is created, already saved to the database. * @throws IOException if there is something wrong. */ public Image createImage(MultipartFile mFile) throws IOException; /** * Stores the file in the url on the server and return the * {@link Image} object to represent it. * @param url url of the source image * @return the {@link Image} that is created, already saved to the database. * @throws IOException if there is something wrong. */ public Image createImage(URL url) throws IOException; /** * @param mFile - the file to be stored. * @param image - the image object to change file of * @return image updated with the file replaced. * @throws IOException if there is something wrong. */ public Image changeImage(MultipartFile mFile, Image image) throws IOException; /** * @param file - the file to be stored. * @param image - the image object to change file of * @return image updated with the file replaced. * @throws IOException if there is something wrong. */ public Image changeImage(File file, Image image) throws IOException; /** * This creates a no.dusken.aranea.model.Image object from a file, and saves * the object to a database. * Deletes the file passed to it. * * @param file is the image file to use. Should end with jpg, jpeg, png or * gif (it ignores case) * @return the image that is created, already saved to the database * @throws IOException if anything goes wrong */ public Image createImage(File file) throws IOException; }