Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

produces

@RequestMapping(value = "api/images")
public class ImageController {

    @Autowired
    public ImageService imageService;
    @PostMapping(value ="upload")
    public ResponseEntity uploadImage(@RequestParam MultipartFile     file){
        return this.imageService.uploadToLocalFileSystem(file);
    }
    @GetMapping(
            value = "getImage/{imageName:.+}",
            produces = {MediaType.IMAGE_JPEG_VALUE,MediaType.IMAGE_GIF_VALUE,MediaType.IMAGE_PNG_VALUE}
    )
    public @ResponseBody byte[] getImageWithMediaType(@PathVariable(name = "imageName") String fileName) throws IOException {
        return this.imageService.getImageWithMediaType(fileName);
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #produces
ADD COMMENT
Topic
Name
9+9 =