wicket-bootstrap icon indicating copy to clipboard operation
wicket-bootstrap copied to clipboard

SummernoteEditor: Image upload works, but retrieving fails because part of URL is missing

Open trippledave opened this issue 8 years ago • 4 comments

Hello, my URL looks like this: https://localhost/project/pageWithEditor. I extended SummernoteStorage to store the images in a DB, which works, but when the browser tries to retrieve the image it uses the URL: https://localhost/summernoteimages?image=... So the "/project" part is missing.

trippledave avatar Dec 16 '16 15:12 trippledave

I've created a branch with a fix: bug/651-summernote-storage-id. It uses Component#urlFor() to create a correct url to the mounted resource reference. But to create the url I need to provide a storageId. What do you think is better:

  • to break the API, as in the branch
  • or to break at runtime if image upload is used and if #getStorageId() returns empty string ?

/cc @klopfdreh

martin-g avatar Dec 18 '16 19:12 martin-g

Maybe you can do all those changes except providing a default storageid and don't make the class abstract - WDYT?

klopfdreh avatar Dec 18 '16 21:12 klopfdreh

What would be a default storageId ? One can have more than one FileStorages, right ? And they will have different ids.

martin-g avatar Dec 18 '16 21:12 martin-g

I had a look at:

https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/67473ba5a96d3313ce025a5378e2d62ec948ee36/bootstrap-extensions/src/main/java/de/agilecoders/wicket/extensions/markup/html/bootstrap/editor/SummernoteFileStorage.java

The storageid is used as a subfolder name to store the images - so I think it should be used only once per editor.

So if you have two editors you have two ids to separate the image files in two folders.

You can generate one id per editor and it should be safe.

In the database the implementation could be that you can use the id for a column to select all images from a specific editor.

Long time ago since I implemented that. :-)

klopfdreh avatar Dec 19 '16 01:12 klopfdreh