Skip to content

Preview provider registration in manager - #14857

Merged
DeepDiver1975 merged 16 commits into
masterfrom
preview-provider-registration-in-manager
Mar 20, 2015
Merged

DeepDiver1975 merged 16 commits into
masterfrom
preview-provider-registration-in-manager

Conversation

@nickvergessen

Copy link
Copy Markdown
Contributor

Comment thread lib/private/previewmanager.php Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

\OCP\Image extends \OC_Image and getPreview() returns \OC_Image so this wrong.

However there is no \OCP\IImage (and it looks stupid), so I'd suggest to:

  1. Add an interface \OCP\IImage
  2. Make \OC_Image implement \OCP\IImage and ignore \OCP\Image (which then still implements the interface)
  3. Change all type references from \OC_Image and \OCP\Image to \OCP\IImage

Opinions? @DeepDiver1975

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Opinions? @DeepDiver1975

sounds reasonable .. go for it - thx

@LukasReschke

Copy link
Copy Markdown
Contributor

Good move! Thanks 🚀

Generally speaking we should drop all not officially supported providers and have the community handle them. We just cannot at the moment enable them without security impact etc. – And that whole "ffmpeg" magic and Co. drives me crazy :)

Comment thread apps/files_sharing/templates/public.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove from the template?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread lib/public/iimage.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

from an API perspective I'd move all these load methods to a factory

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The contacts app also calls them atm. I'd love to do that in a different PR then.
But I guess we can remove the load* from the interface and if someone needs them, they just continue to ignore the public interface for now, until the factory has been created.

@nickvergessen
nickvergessen force-pushed the preview-provider-registration-in-manager branch from 50d4dc1 to 8f06353 Compare March 16, 2015 11:58
@scrutinizer-notifier

Copy link
Copy Markdown

The inspection completed: No issues found

@ghost

ghost commented Mar 16, 2015

Copy link
Copy Markdown

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/10481/
Test PASSed.

@scrutinizer-notifier

Copy link
Copy Markdown

The inspection completed: 7 new issues, 7 updated code elements

@oparoz

oparoz commented Mar 16, 2015

Copy link
Copy Markdown
Contributor

Also, for this to work, at least all the methods described in #12772 have to be included, otherwise apps will stop working because providers will be in an object they can't use and the one they can use doesn't include any providers.

@nickvergessen

Copy link
Copy Markdown
Contributor Author

these methods are on \OCP\IImage, not on the preview manager.

@oparoz

oparoz commented Mar 16, 2015

Copy link
Copy Markdown
Contributor

Nope, they're on Preview used both before generating the preview
and after to have access to it.

@nickvergessen

Copy link
Copy Markdown
Contributor Author

Execatly, the Preview, not the PreviewManager. So this is a seperate thing and should be done in a separate PR ;)

@oparoz

oparoz commented Mar 16, 2015

Copy link
Copy Markdown
Contributor

No, not on the returned preview which is an \OC\Image, but in \OC\Preview itself.

PreviewManager is the public interface to Preview, already providing methods such as isMimeSupported() and createPreview(), so that's the class all apps should use and that's the only class which will have access to providers once they all move outside of core, so that class needs to have all the methods of Preview in order to be a proper replacement.

@nickvergessen

Copy link
Copy Markdown
Contributor Author

PreviewManager has a method createPreview()
This takes the $file, $maxX, $maxY, $scaleUp as an argument and then returns the getPreview() on the Preview object.
All those parameters are also parameters on the getThumbnail() method of the preview providers: https://github.com/owncloud/core/pull/14857/files#diff-d8470bc02ce010eabf8e08c208e64108R29
So I can't see what would be missing.

@oparoz

oparoz commented Mar 17, 2015

Copy link
Copy Markdown
Contributor

What's missing are all the public methods. We can't possibly know of all their use. I can already give you three examples of files which are not compatible with the PreviewManager:

  • Missing setKeepAspect() & showPreview() needed in preview.png
  • Missing isCached() needed in Picture
  • Missing getPreview() needed in Gallery+

All these methods are listed in #12772

It might not be the responsibility of this PR to include them all, but you can't disable providers in core without offering access to them the same way they're accessed to today.

@nickvergessen

Copy link
Copy Markdown
Contributor Author

Sorry, but you seem to mix up the preview providers with what is done on the preview/image later on.
So yes, that is still the task of another PR, if it needs to be done at all (and not lead to some fixes in the apps)

@oparoz

oparoz commented Mar 17, 2015

Copy link
Copy Markdown
Contributor

EDIT: I've looked at the code and see what you mean now. We can still use Preview like we always have and it will be using the PreviewManager to get access to the providers. All good in this case. By reading the comments, I thought the functionality was removed from Preview and apps would have to use the PreviewManager exclusively.

@MorrisJobke

Copy link
Copy Markdown
Contributor

@oparoz @nickvergessen Is this now the way we want to have it? does it work already? Can we start reviewing? What about @LukasReschke comments?

@oparoz

oparoz commented Mar 20, 2015

Copy link
Copy Markdown
Contributor

The overall plan works for me
Currently in this PR
Apps -> Preview -> PreviewManager -> Providers in lib/private

What's left is to convert all providers into AppFramework apps and have something like this

Apps -> Preview -> PreviewManager -> Provider apps

but if I'm not mistaken, this can be done in another PR.

@MorrisJobke

Copy link
Copy Markdown
Contributor

but if I'm not mistaken, this can be done in another PR.

Yes

@MorrisJobke

Copy link
Copy Markdown
Contributor

Just tested with a bunch of files and all previews still work 👍

@nickvergessen

Copy link
Copy Markdown
Contributor Author

yes, this PR is complete.
Next step is to move the providers out in suitable junks of apps

@DeepDiver1975

Copy link
Copy Markdown
Contributor

👍

DeepDiver1975 added a commit that referenced this pull request Mar 20, 2015
…-in-manager

Preview provider registration in manager
@DeepDiver1975
DeepDiver1975 merged commit afa8872 into master Mar 20, 2015
@DeepDiver1975
DeepDiver1975 deleted the preview-provider-registration-in-manager branch March 20, 2015 15:34
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants