1

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 ?

Roman C
  • 49,761
  • 33
  • 66
  • 176
John
  • 142
  • 1
  • 11
  • 1
    It's unclear what did you do to get it working. – Roman C Mar 26 '16 at 15:52
  • The `data-img-src` should be the url of your image, check if the images are on the server and make sure you do not have any `javascript` error by checking browser console. – Alireza Fattahi Mar 29 '16 at 09:14
  • if i include the the image directly like `` it is displayed but the picker doesn't work. – John Mar 31 '16 at 18:02

1 Answers1

0

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();
Armini0
  • 1
  • 4