Kotlin SpringBoot RestAPI – Bootstrap 4 Image – Jquery
In the tutorial, JavaSampleApproach will show how to show images on web-view from Kotlin SpringBoot RestAPI with Bootstrap 4 Image and Jquery.
We create a Kotlin RestAPI:
@GetMapping(value = "/api/image")
fun getImage(): ResponseEntity{
val imgFile = ClassPathResource("image/jsa_about_img.png")
return ResponseEntity
.ok()
.contentType(MediaType.IMAGE_JPEG)
.body(InputStreamResource(imgFile.getInputStream()))
}
We use Bootstrap 4 Image to style data on web-view, with results:
Bootstrap 4 Image provides useful classes to style with images:
.rounded class
adds rounded corners to an image.rounded-circle
shapes the image to a circle.img-thumbnail
shapes the image to a thumbnail (bordered)More at:
Kotlin SpringBoot RestAPI – Bootstrap 4 Image – Jquery
#kotlin #springboot #jquery #bootstrap