Dynamic Image Input


I would like to be able to dynamically change the image of a CssLayout by dragging and dropping an image into it.
It works fine on the local computer, but not on other computers in the network.

I tried to store the StreamResource of the image and draw it that way, but no dice.

It seems like I need to store a copy of the image on the server, but how do I go about doing that, dynamically?

For my purposes, it would be great if I could copy the entire image into an Object, and then distribute it from memory.

I’m sorry if I’m not being clear, I’m a bit of an amateur.


More info;
this.image = (StreamResource) MyDatabase.getImage;
Embedded newImage = new Embedded(null, this.image);

private void showComponent(Component c) {

    VerticalLayout layout = new VerticalLayout();
    ((CssLayout) root).setSizeUndefined();
    ((CssLayout) root).addComponent(c);