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

feat: show images in a document with the viewer #2924

Merged
merged 2 commits into from
Jan 24, 2023

Conversation

luka-nextcloud
Copy link
Contributor

Signed-off-by: Luka Trovic luka@nextcloud.com

Summary

@max-nextcloud
Copy link
Collaborator

@luka-nextcloud Please fix the eslint issues. Thanks!
You can also check for them locally by running npm run lint.

Copy link
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The directory path for the first PROPFIND is wrong. It seems it looks for STORAGE_ROOT/ATTACHMENT_DIR_NAME so it only works for documents in user's storage root.
  • This will not work when accessing the document via a shared access. We could use the endpoints provided by the attachment controller. These are public endpoints using the Text edition session to authenticate. I can help in this department if needed.

You could use #getImageAttachmentUrl() in src/services/AttachmentResolver.js which ends up getting the image from AttachmentController::getImageFile().
Problem is that this method only returns a preview for now. We could add a parameter to choose between raw content or preview.
There is still the special case of images which can't be displayed but for which there is a preview provider. So in this case, the preview would be a fallback even if asking the raw image.

@julien-nc
Copy link
Member

#2974 might help here. You could get the image URL with #getImageAttachmentUrl(FILE_NAME, true).

@julien-nc
Copy link
Member

@luka-nextcloud #2974 is merged now 😁

@luka-nextcloud luka-nextcloud force-pushed the feature/open-embedded-image-in-original-size branch from 550139d to 19407b3 Compare October 4, 2022 16:37
Copy link
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done!

  • A few remaining eslint warnings and errors (npm run lint)
  • The image could use all the available space and avoid overflow. See inline basic style suggestion.
  • The dav helper is not used anymore and could be removed IMO
  • Pressing escape closes the modal and the document (the viewer). @max-nextcloud @vinicius73 Do you know if there is any way to avoid that?
  • some other inline comments

@juliusknorr juliusknorr added the enhancement New feature or request label Oct 11, 2022
@juliusknorr juliusknorr added this to the Nextcloud 26 milestone Oct 11, 2022
@luka-nextcloud luka-nextcloud force-pushed the feature/open-embedded-image-in-original-size branch from 19407b3 to 14ca32b Compare January 17, 2023 18:29
@cypress
Copy link

cypress bot commented Jan 17, 2023



Test summary

116 0 0 0Flakiness 0


Run details

Project Text
Status Passed
Commit dc343ee
Started Jan 23, 2023 10:53 PM
Ended Jan 23, 2023 10:55 PM
Duration 02:47 💡
OS Linux Ubuntu -
Browser Electron 106

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

Copy link
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luka-nextcloud 👍 We're close. There's still an overflow issue when the image height is too big. It would be nice to get something like in the previous screencast: that the image is entirely visible, takes the most space possible and keeps its aspect ratio.

Signed-off-by: Luka Trovic <luka@nextcloud.com>
@luka-nextcloud luka-nextcloud force-pushed the feature/open-embedded-image-in-original-size branch from 83e8eda to 5984413 Compare January 23, 2023 18:45
@luka-nextcloud
Copy link
Contributor Author

@julien-nc Can you please check again?

@julien-nc
Copy link
Member

/compile

Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@juliusknorr
Copy link
Member

@luka-nextcloud Would be great to have a cypress test for this :)

@luka-nextcloud luka-nextcloud merged commit 9ea8089 into main Jan 24, 2023
@delete-merged-branch delete-merged-branch bot deleted the feature/open-embedded-image-in-original-size branch January 24, 2023 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Open embedded image in original size
6 participants