Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
trippledave opened this issue Dec 16, 2016 · 4 comments

Comments

@trippledave
Copy link

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.

martin-g added a commit that referenced this issue Dec 18, 2016
…edImageResourceReference

This requires adding an abstract method to SummernoteEditor to get the storageId
@martin-g
Copy link
Owner

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

@klopfdreh
Copy link
Contributor

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

@martin-g
Copy link
Owner

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

@klopfdreh
Copy link
Contributor

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. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants