OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.36k stars 2.37k forks source link

[Design] Media Services #561

Closed sebastienros closed 6 years ago

sebastienros commented 7 years ago

Before I even start thinking about the design of this feature, I want people to comment on the existing implementation (Orchard1) or suggest changes.

The issue includes these topics

Some open questions to start the discussion:

Overall I think what is in Orchard 1 is perfect, but I also think some features are not really as useful or popular as I had imagined (profiles, import sources).

/cc @Piedone @bleroy @anoordende @jeffolmstead

Piedone commented 7 years ago

I've never used Profiles or have seen them be used, but that doesn't mean it's useless...

I'd made the Media import workflow easier: currently it's create folder if not already > Import > do stuff > OK. If it would be just a drop zone and upload button in the folder view that would be much simpler. This also relates to extensible Media import, what I have never used or seen being used either (but we could still keep it, just make the most used local import a more obvious one).

I'm OK with the abstractions and Media items being content items. not sure what you mean by "per user media".

sebastienros commented 7 years ago

The "per user media" is the special folder of Media items that are only editable by the current user.

sebastienros commented 7 years ago

Drupal is very flexible, but man I was lost after half the article. Not even sure how beneficial this is compared to what we have in O1 https://www.webwash.net/manage-media-assets-drupal-8/

DaRosenberg commented 7 years ago

I never use profiles either, and haven't seen them used. But as @Piedone says, doesn't mean they're not useful, maybe people are just not aware, maybe they are not discoverable enough?

Storage abstractions are super important. Custom import providers I think should definitely be there - for example, the Azure Media Services solution would not be possible without them.

How can we make the current UI even better?

Well, "even" better... :) The current UI is really bad. It completely breaks down when the media picker dialog happens to be invoked from within something that is already a dialog, with nested dialogs and iframes and multiple close buttons etc. To make it acceptable, we should solve this problem in a different way, and not nest dialogs in dialogs. Perhaps instead design these dialogs as "blades" and stack them horizontally like the Azure Portal does?

Making media content items was a good move IMO, and personally I think we should keep it:

The biggest problem in O1 media management is that items are embedded by resolved URL into content. For OC my biggest wish would be to change this, so when you insert an image into Markdown or HTML, we use a special syntax to identify it by its content item ID, and use a filter to resolve it to the actual URL at rendering time. Inserting absolute URLs into content causes so many problems around portability of content, continuous integration, etc.

@sfmskywalker might have some design notes on this somewhere - I looked for an issue where we outlined the design we came up with for this, but couldn't find it. There is an old issue however on this (https://github.com/OrchardCMS/Orchard/issues/1880).

sebastienros commented 7 years ago

Keep support "per user" media and media file replacement out of the box?

I am suggesting to just rely on "Manage Own Media" to prevent a user from editing media items that are not his own. Users can create personal folders if they need. All media items can be selected, even with "Manage Own Media" only.

As a reminder, the scenario is for a multi-blog site, each user might want to organize it's media independently. Or we might not want someone to edit existing media that are not theirs.

sebastienros commented 7 years ago

To simplify the UI, I am suggesting to keep the current screens for Media management, but when we need to select media use a specific media selection that would only allow Image creation on the fly. Any other complex media operation would require to go to the media management screen instead. Then there would be a single dialog to select a media or drag and drop an image. Other screens would be full screen.

agriffard commented 7 years ago

Will there be a possibility to add files in the Media directory on the disk and have an action from the admin UI to 'import as content' the files that are in the physical folder but not yet appearing in the Media library?

agriffard commented 7 years ago

BTW, Media upload doesn't work for me anymore.

I managed to upload an image when I tested the first commit of the media branch. Now, the file is uploaded to the folder, I can see in debug that a content item is created but nothing is saved in the database anymore and the UI doesn't display the uploaded file.

sebastienros commented 7 years ago

It should work with the latest commit, I can create and delete folders too.

Yes, I think the Media Import should be part of it. But not sure we need it for a v1, unless someone does it for free. Would be better to have it as part of the Import Media tab that we'll have after the common features are implemented. The code is already in the Update module for O1.And it only applies to the FileSystem provider.

jersiovic commented 7 years ago

My two cents. Yes we use profiles, I think they are very convenient. We provide same theme for different tenants. Using Profiles allow admin of each tenant to set the size of images used on different areas of the web without contacting us.

Hazzamanic commented 7 years ago

My two cents, which seems to be resisting the general wisdom, though I'm sure I can be converted...

Moving to content items I didn't much like this change.

Regarding the WAMS integration, I'd be interested in hearing how much use this has received and how important it being baked into media area has been. Genuine questions. Because as you say, media content items are required to make that kind of integration. It's the only implementation of its sort I've heard of; are there any other modules extending the media module like it? My last job involved building streaming websites within Orchard and we opted not to use the media module to handle our videos (our videos were content items) because we would be writing such a customized pipeline for uploading (as did the WAMS module I imagine) that using the media module didn't really bring any benefits, only constraints. I also felt videos and images/downloads were separate, though this stemmed from the nature of the sites I guess, being specifically for video streaming.

Profiles I love these. Use them all the time. Have extended them with my own providers several times. They are great, please keep them.

UI I'm going to be douche here and agree with Daniel Stolt. I don't think the existing UI could be much worse. I also think we should use an existing uploader like dropzone or the like (or make it possible to drop in different upload mechanisms) because the current one has crashed on me too many times.

Providers I think these have potential still, and can be kept while making the upload process more streamlined. But yeah, someone just needs to build the providers ^_^

Per user I have never used this but I think it is a great feature to have, lots of scenarios come to mind.

The Rest I think the whole media in Orchard has suffered from a massive lack of documentation for both its features and its extension points. It has a decent image editor that I've heard zero about, profiles seem almost unknown to people.

Maybe controversial but I don't think putting time in to support the upload and display of video or audio is worth it. People use external providers because they offer real functionality. People can always add support if they want it...

The relevant discussions about media management in O1 might be helpful too? http://orchard.codeplex.com/discussions/359624 http://orchard.codeplex.com/discussions/402143

EDIT: clarity

agriffard commented 7 years ago

For th UI, I like the way http://jeremyfagis.github.io/dropify/ allows to replace and enhance a fileupload.

I think Profiles (or transformations as you seem to call them) has to be taken from O1 but a MediaPickerField should have options like:

A FileUploadField should also be something available ootb to be used in Front-end Forms.

The next two features I am expecting are:

agriffard commented 7 years ago

@sebastienros Can please merge the Orchard.Media Module branch?

I will try to make the MetaWeblogHandler to allow supportsFileUpload.

sebastienros commented 7 years ago

@Hazzamanic Thanks a lot for the extensive feedback.

UI

Can we agree that the issue is the current stacked modal dialog implementation that is super hacky? I have another implementation right now in O2 that is only based on Vue.js and is reused "exactly as is" for both the main media management page and the media selection. Daniel was somehow explicit about his issues with it, but I could use more details about yours.

I don't think we should be able to plug different upload libraries. We need one that works with Orchard. If there are bugs with one library, we should switch to a better one. I am using jQueryUpload (https://github.com/blueimp/jQuery-File-Upload) in O2 too, and would love to know what doesn't work with it. I found dropzone that you mentioned, I am glad to use it if it's better (https://github.com/enyo/dropzone). At least make it more obvious that we can drag and drop files.

Content Items

I totally understand your concern. I might have an idea then. What about have a Media section just to manage files, which would look a lot like the current media management, but not based on content items. And then at the same time create some content types like Image that would have a Media Picker field and select one media, and optionally define custom content. This one would be draftable and localizable, with custom fields or taxonomies.

Then in your content editors (body, markdown, ...) where you need to insert a file, the picker would expose the Media, not the content items. The content items would be used with a Content Item Picker if you need to reference more that just files. This would also solve the issue that we have to load a content item right now to be able to inject an image url. We would still use a specific tag to reference a relative file path, like {{{ media 'kittens/kitten1.jpg'}}}. Having some event when files are added would allow custom modules to create Content Items automatically if they need (only when added from the UI).

Another option would be to keep Media as content items, but have the content editors use the file system directly, but that would require two different pickers, more work.

Profiles

Profiles (as in predefined named sets of filters ) can be done later, as long as we can already apply filters when we insert a media, or use them from a view (using a tag helper). So from a body we would have something like {{{ media 'kittens/kitten.jpg' 350x120 resize }}} and from a Razor View <media src="kittens/kitten.jpg" width="350" height="50" action="resize" />.

I think we could also leverage the File Picker by exposing templates for it, and even expose <picture> and srcset (https://www.html5rocks.com/en/tutorials/responsive/picture-element/).

anoordende commented 7 years ago

Forgive me for not having had a moment to check out the O2 media branch yet, but here are my 2 cents worth based on O1.

Content Items

I have dearly missed some functionality ever since the move from MediaPicker to MediaLibrary:

With regards to still needing Content Items, just thinking out loud:

User Experience

End-user experience with uploading and organising media has been a drama in O1. Of course, this is end-user "error", but I'm sure we can do more in terms of configurable features that make uploading media more transparent (read: very, very facebook-style easy) to the novice end-user:

Injecting Media URL's

I've always argued that URL's injected by the picker et al should be relative (or a tag as being described above) and be rewritten to the local media path, CDN, blob storage, etc. based on the environment settings. This is also crucially important when moving domains and is WP's horrid achilles heel.

The tag solution as described by @sebastienros sounds perfect in what it can achieve, especially if a hook can be included for 3rd party modules to transform the final element rendering.

In addition, I would also consider that, in the WYSIWYG editor, images can be resized and may have to get cut down to that size (See discussion)

SEO

Storage

We should be able to plug in any (3rd party module) storage provider, from local file system to cloud-based (central storage is crucial for a load-balanced environment), and, depending on the storage provider's capabilities:

Import & Upload

To ease the pain of uploading (especially on a slow connection), I would suggest renaming O1's "Import" to "Upload" and re-purpose "Import":

Import Provider modules could provide, for example, the following functionality:

Profiles and Filters

I'd be perfectly happy not to have profiles at all, as long as we can specify an array of filters (in order!) to be applied, together with parameters, something like {{{ media 'kittens/kitten.jpg' 350x120 resize='max' watermark='my-watermark.png,bottom-left' }}}

Filters should specify something like a SupportedFormats property so that the service can fail gracefully and produce a meaningful error before even attempting to run the filters.

We use profiles extensively, but the O1 workflow is not very atomic when used in views. Before deployment, you first must make sure the profile exists, names match, sizes match the attributes, etc. Anything that can be under source control has my vote.

Per User

Indeed we should differentiate between managing your own, publicly accessible media and per-user secured storage. The latter has recently become a requirement for us, but this is being solved outside of Orchard. Having said that... killer feature :)

*Serving Media Relative to Site

This is our favourite internal recurring topic and difficult to solve, although we did have a solution in O1, it was difficult for various reasons. The end-goal is that, no matter where media is stored, it will (also-) always be available under http://my.domain.com/Media/Tenant/..

The O1 implementation of storage providers, such as Azure Blob Storage, turned the blob storage more into a CDN than just storage. I'd suggest to put this right and only use this as storage backing, with the media still being served under the site.

If a particular setup still wishes to use the storage provider directly, it can be done by setting something like a PublicMediaBaseUrl config to anything other than blank. The same for using a CDN. In turn, the CDN can be configured to use the storage provider directly as a source, or the site itself.

Some CDN's have the ability to automatically set the rel=canonical HTTP header based on the source, but perhaps it makes sense to to add this in Orchard by default? In any case, it would be very easy to add on most webservers.

sebastienros commented 7 years ago

Thanks @anoordende that's very informative.

Not sure you watched the video from two weeks ago as I talked about some of these points and came to the same conclusion as you. We will go back to a file based media screen that will reflect the actual files on the FS. Also use relative path to link to media, or apply transformations using tokens.

We are keeping the possibility of having content media items, but this will be optional, and kind of natural like any other content type, by using a File Picker in a custom type. We will also introduce a new concept, Attachments, that will let you create media items embedded in your content types, and define the metadata here. Then if the content item needs these to render something (slides, body, ...) the items and their metadata will be available in memory already.

The CDN s. Azure blobs makes totally sense, as I came to the same conclusion. I was wrong when I designed it. So now the Azure Blob will just be a file store, and the image filters will use an independent cache storage. CDNs will query the server based url, and the server will transform the image live, while the CDN can then cache the result, and we can also store it locally (not in the same media files folder) if we don't want to rely on a CDN.

sebastienros commented 7 years ago

The Attachment Part can be done after beta.

We can have custom tags/filters to depict the differences from a media that comes from

agriffard commented 6 years ago

Can Media Design be closed?

Many features have been implemented.

If we plan to implement other features, we should create specific issues.