Struts2 Bootstrap Image Selection

256 Views Asked by At

I am looking for a image selection like shown here:

https://rvera.github.io/image-picker/

But i do not get it work with Struts2 and Bootstrap, because the images are not displayed.

What i did:

  • included the .js and .css from git
  • imported the .js and .css to my jsp like this

    <link href="style/image-picker/image-picker.css" rel="stylesheet"> <script src="style/image-picker/image-picker.js"></script>

  • copied example to my jsp

    <select class="image-picker show-html"> <option data-img-src="images/process/xxx.jpg" value="xxx.jpg"> xxx </option> <option data-img-src="images/process/yyy.jpg" value="yyy.jpg"> yyy </option> <option data-img-src="images/process/800_300.png" value="800_300.png"> Default </option> <option data-img-src='http://www.example.com/image.jpg' value='42'> </select>

Do you have any better solution for a image selection or an idea how to get the image picker worked ?

1

There are 1 best solutions below

0
Armini0 On

I know this is an old question, but did you fix it?

You should just call the constructor of the imagepicker and then use the on the select.

$('.image-picker').imagepicker();