Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Image implements Serializable {
- private byte[] profilePic;
- private String user_id;
- private String profilePicContentType;
- //getter & setter methods below
- }
- @RequestMapping(value = "/images",
- method = RequestMethod.POST,
- produces = MediaType.APPLICATION_JSON_VALUE)
- @Timed
- public ResponseEntity<Image> createImage(@RequestBody Image image) throws URISyntaxException {
- log.debug("REST request to save Image : {}", image);
- if (image.getId() != null) {
- return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert("image", "idexists", "A new image cannot already have an ID")).body(null);
- }
- Image result = imageService.save(image);
- return ResponseEntity.created(new URI("/api/images/" + result.getId()))
- .headers(HeaderUtil.createEntityCreationAlert("image", result.getId().toString()))
- .body(result);
- }
- <div class="btn btn-primary" ngf-select ng-model="vm.settingsAccount.profilePic" name="file" ngf-pattern="'image/*'"
- ngf-accept="'image/*'" ngf-max-size="16MB" ngf-min-height="100"
- ngf-resize="{width: 100, height: 100}">Select</div>
- var imageDomain = function (settingsAccount){
- return {
- profilePic: settingsAccount.profilePic,
- user_id : settingsAccount.login,
- profile_pic_content_type : 'UTF-8'
- }
- }
- function save(){
- vm.image = imageDomain(vm.settingsAccount);
- ImageService.update(vm.image);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement