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

Spike: Research all existing plugins for shared media library #97

Closed
PriyaBhatia0210 opened this issue Feb 3, 2021 · 13 comments
Closed
Assignees
Labels
must have Must be done, high priority
Milestone

Comments

@PriyaBhatia0210
Copy link

PriyaBhatia0210 commented Feb 3, 2021

We want to research the prior work that has been done on a the shared media library before we can get into building the Globally managed assets feature.

Following are the ones we could evaluate:

  1. Network Media Library
  2. Asset Manager framework
  3. Shared Media Library
  4. Multisite Global Media

Time box: 2 days

@PriyaBhatia0210 PriyaBhatia0210 added enhancement must have Must be done, high priority and removed enhancement labels Feb 3, 2021
@jennybeaumont jennybeaumont added this to the v7 sprint 2 milestone Feb 16, 2021
@roborourke
Copy link
Contributor

Wanted to also note that we should catch up with @shadyvb to find out how far along the work on allowing multiple AMF sources is.

@roborourke
Copy link
Contributor

Also @onyekaa has kindly already done the work for using WP as a source for AMF https://github.com/humanmade/amf-wordpress

@jazzsequence
Copy link
Contributor

I did some testing on my personal site with AMF and @rmccue's Unsplash source. It's good but agree that we'd need multiple sources for it to be feasible.

@jazzsequence jazzsequence self-assigned this Feb 25, 2021
@jazzsequence
Copy link
Contributor

jazzsequence commented Feb 26, 2021

Network Media Library

Network Media Library appears very slick, at least in that it doesn't change any UI and just operates transparently in the background. Unfortunately, it doesn't support any kind of local or site-specific media -- everything is routed through the central media library, which is a site that is defined on the network.

Scenario 1
Given: I have created and edited a media asset
When: I upload it to the WP media library from my local website
Then: The same should be made available to our organization's global network as a singular attachment
And: Any further edits to this file should get updated in the central library seamlessly in real time

✅ All media uploads are routed through the central media library. There's only one file -- the one that exists in the central media library.

Scenario 2
Given: I want to use a media file in one of our web properties (social, web, etc.)
When: I want to insert a media file from the media library
Then: The media library should contain the most recently updated version of an asset that I want to use

✅ Since there's only one file (excluding image sizes), it's always the one that's the most up-to-date.

Scenario 3
Given: There is some meta data (alt text, caption, description) associated with a file
When: I use that media file in another location
Then: The existing meta data should be carried over

✅ Again, since it's all one file, all the meta data that exists is relative to the file that's been uploaded to the central media library.

Scenario 4
Given: I am editing a local website of a network
When: I insert a media file from the central media library
Then: I should be able to over-write the meta data

❌ Sites essentially fight over the metadata. Metadata added to an image in one site will get overwritten when updated/changed from another site.

This functionality would need to be added as middleware.

Scenario 5
Given: I am on a local website
When: I delete a media file
Then: The file should not get deleted from the global central library

❓ There's actually no way to delete media files except doing so from the central media library site. Not sure if this is a pro or a con, to be honest. But it does restrict who is able to delete files to only those people who have access to that site. However, it's possible (unlike with AMF) with built-in multisite functions, to build out functionality to delete an image from the central media library site.

Scenario 6
Given: I am on a global website
When: I delete a media file
Then: I should get a warning that the file could be used in other places
And: If accepted, it should be deleted from all local sites

❌ This would need to be added as middleware. Seems feasible though.

@jazzsequence
Copy link
Contributor

jazzsequence commented Feb 26, 2021

Asset Media Framework

Asset Media Framework works somewhat similarly to Network Media Library in that it is a drop-in replacement of the media library that provides no new UI. However, where it differs is where it gets it's images and how it handles them. Instead of using a site on a WordPress multisite network to manage the media library, AMF can be configured to use essentially any external source as a media library assuming there's a separate plugin to handle connecting the site to the source (see Ryan's Unsplash source and Onyeka and Thorsten's WordPress source).

The downside of this approach (or...possible upside, depending on your perspective, I suppose) is that the source is read-only. You're just a client receiving images from an separate site (as far as AMF is concerned, regardless of whether that site is on the current network or not). The source itself is irrelevant, it just provides images for client sites to receive. This limits how images can be manipulated, but ultimately that could be used to play in our favor.

Scenario 1
Given: I have created and edited a media asset
When: I upload it to the WP media library from my local website
Then: The same should be made available to our organization's global network as a singular attachment
And: Any further edits to this file should get updated in the central library seamlessly in real time

⚖️ This is "a little of column a; a little of column b" as it doesn't strictly apply. First off, one cannot create and edit a media asset, at least not directly, and not from a client site. The media asset is either there (because it exists on the source) or it's not. An approach similar to Network Media Library could be used where a central media library site exists on a network and that's provided as the source, but that still excludes uploading to the source from the client site itself.

That said, there's one attachment, one file, and it is always canonical.

Scenario 2
Given: I want to use a media file in one of our web properties (social, web, etc.)
When: I want to insert a media file from the media library
Then: The media library should contain the most recently updated version of an asset that I want to use

✅ Since there's one source of truth for images, there's only one file, regardless of the source that was defined. The image URL comes directly from the source, too. For example, when I used another site on the same network, the source URL pointed to the media folder for that site on the network. When I used my personal site as the source, the source URL pointed to the CDN image url that I use on my site. Similarly, the "View attachment page" link points to where it exists on my site.

Scenario 3
Given: There is some meta data (alt text, caption, description) associated with a file
When: I use that media file in another location
Then: The existing meta data should be carried over

✅ Using the AMF WordPress plugin, the Title, Caption, Alt Text and Description are pulled from the source and therefore always consistent.

Scenario 4
Given: I am editing a local website of a network
When: I insert a media file from the central media library
Then: I should be able to over-write the meta data

❌ Using the AMF WordPress plugin, the aforementioned Title, Caption, Alt Text and Description fields (as well as the image URL) are all disabled and can't be edited. This is probably for the best to avoid the problem described in Network Media Library. However, it means that we'd need to create a(nother) shadow post type in our own plugin in order to store local meta data about an image. (This might actually be easier to deal with in AMF than in NML though, since there's nothing there to overwrite the source to begin with.)

Scenario 5
Given: I am on a local website
When: I delete a media file
Then: The file should not get deleted from the global central library

❌ There is no way to delete a file in the source media library from a client library. They are not connected.

Scenario 6
Given: I am on a global website
When: I delete a media file
Then: I should get a warning that the file could be used in other places
And: If accepted, it should be deleted from all local sites

❌ See above. There's no way to delete a file on the source from the client in AMF as the relationship is read-only.

@jazzsequence
Copy link
Contributor

Shared Media Library

This plugin works essentially like Network Media Library with the exception that it's less documented, less recently updated, and uses the main site (e.g. blog id 1) as the source of truth for media files. In my testing, I was unable to upload files from any site in the network, including the main site, so there were some parts that I was unable to fully dig into. Honestly, this one didn't appear to be different enough in functionality from Network Media Library to explore too thoroughly and I immediately ran into issues when I tried deleting a media file.

Scenario 1
Given: I have created and edited a media asset
When: I upload it to the WP media library from my local website
Then: The same should be made available to our organization's global network as a singular attachment
And: Any further edits to this file should get updated in the central library seamlessly in real time

❌ I was unable to upload images at all. Whether this was due to a bug or a configuration issue I wasn't able to determine. There wasn't any documentation to refer to other than the codebase itself. Presumably, however, since it works the same as Network Media Library, if it was working, it would work the same.

Scenario 2
Given: I want to use a media file in one of our web properties (social, web, etc.)
When: I want to insert a media file from the media library
Then: The media library should contain the most recently updated version of an asset that I want to use

✅ Like Network Media Library there's only one file (excluding image sizes), so it's always the one that's the most up-to-date.

Scenario 3
Given: There is some meta data (alt text, caption, description) associated with a file
When: I use that media file in another location
Then: The existing meta data should be carried over

✅ Again, since it's all one file, all the meta data that exists is relative to the file that's been uploaded to the central media library.

Scenario 4
Given: I am editing a local website of a network
When: I insert a media file from the central media library
Then: I should be able to over-write the meta data

❌ Sites essentially fight over the metadata. Metadata added to an image in one site will get overwritten when updated/changed from another site. This behavior worked the same as Network Media Library.

Scenario 5
Given: I am on a local website
When: I delete a media file
Then: The file should not get deleted from the global central library

❌ I was able to delete a file from the main site, but it broke the images in all my media libraries. The file did ultimately get deleted (I...think?) across all sites but that may have been because I did it from the main site.

Scenario 6
Given: I am on a global website
When: I delete a media file
Then: I should get a warning that the file could be used in other places
And: If accepted, it should be deleted from all local sites

❌ This would effectively be the same as Network Media Library.

@jazzsequence
Copy link
Contributor

Added https://github.com/bueltge/multisite-global-media to the list of plugins to test as it's linked from Network Media Library and probably worth adding to this list.

@jazzsequence
Copy link
Contributor

jazzsequence commented Mar 2, 2021

Multisite Global Media

Multisite Global Media works very similarly to Network Media Library. A site is defined via a filter to be the "global" media library. However, Multisite Global Media doesn't disable or override the local media library for the current site. In other words, images uploaded to the global site are available to all sites on the network. But in addition to these, individual sites can still continue to upload their own images to their local media libraries. The plugin adds an additional tab in the media modal for Global Media, which is a window into the media library of the previously-defined site.

Screen Shot 2021-03-02 at 1.40.26 PM.png

Scenario 1
Given: I have created and edited a media asset
When: I upload it to the WP media library from my local website
Then: The same should be made available to our organization's global network as a singular attachment
And: Any further edits to this file should get updated in the central library seamlessly in real time

✅ This sort of depends on the context but I'm saying it fulfills the requirement. If an image is uploaded to the global media library site, that image is available to all sites on the network. An image uploaded to a local site is not available to the network. Furthermore, you cannot upload to the global media library from a local site, only from within the global site (which could limit access to the global media library).

Scenario 2
Given: I want to use a media file in one of our web properties (social, web, etc.)
When: I want to insert a media file from the media library
Then: The media library should contain the most recently updated version of an asset that I want to use

✅ Images uploaded to the global media site are canonical and can only be changed/updated from within the global site. Those changes exist everywhere in all contexts.

Scenario 3
Given: There is some meta data (alt text, caption, description) associated with a file
When: I use that media file in another location
Then: The existing meta data should be carried over

✅ The metadata associated with an image on the global media site is used elsewhere when that image is used on local sites.

Scenario 4
Given: I am editing a local website of a network
When: I insert a media file from the central media library
Then: I should be able to over-write the meta data

❌ The metadata for a global image is not editable from a local site, only from the global site.

Scenario 5
Given: I am on a local website
When: I delete a media file
Then: The file should not get deleted from the global central library

❓It's not possible to delete media on the global site from within a local site. However, the local media library operates normally (as opposed to some of the other options that override the media library completely with a global option), so an image that is deleted from a local site, from within that site's media library, is deleted as normal.

Scenario 6
Given: I am on a global website
When: I delete a media file
Then: I should get a warning that the file could be used in other places
And: If accepted, it should be deleted from all local sites

❌ While a pop up appears when you try to delete an image from the global site, this is the same pop-up that you'd get normally and does not specify that the image will be deleted from all sites that might be using it (which it does). A more specific message would need to be developed for the global site.

Note: It took me a while to find it -- because I kept assuming that the problem was in the Global Media plugin itself and not our stuff -- but the Multisite Global Media plugin breaks when our Smart Media plugin is enabled. If we did go forward with using this plugin as a solution, one of the first things we'd need to do would be to resolve this issue.

@jazzsequence
Copy link
Contributor

jazzsequence commented Mar 2, 2021

Summary

While there's no clear-cut winner, there are a few takeaways from evaluating the various different options available.

The first one is that the Shared Media Library should not be used for our global asset management. If it was just a lack of documentation, or just a few bugs, or just that it hasn't been updated in a while, it wouldn't be a problem -- but it's all three issues and (as far as I could tell) it doesn't provide anything noteworthy beyond what Network Media Library can do.

Network Media Library and Asset Manager Framework are more or less on par with each other. The main difference between the two is the approach they take, and there are pros and cons to both approaches. While Network Media Library allows a site's media library to be used natively across the network -- meaning it's easy to upload and use the same files no matter what site you're on -- it lacks the ability to track local, site-specific images and and data, and may grant the user too much privilege over those global files without intervention. This approach might be great if we were also going to introduce limitations on permissions and/or add better search and organization tools at the same time, but if not, it's using a single media library across all sites, with no obvious way to make changes to the metadata and no way to opt-out.

On the other hand, Asset Media Framework would be very limiting without a lot of additional pieces put in the middle or added to the WordPress integration to allow for multiple sources and the ability to access/edit media files from the local site. This feels more appropriate if the project/client was already using an external DAM and we just wanted to provide an interface into that system.

Multisite Global Media takes the same idea as Shared Media Library and Network Media Library but also allows local sites to maintain and use their own media libraries. This seems like the best of both worlds. While it suffers from the same access restrictions as Asset Manager Framework in terms of editing and updating images files and metadata on the global site from a local site, it's not a complete replacement of the media library, either -- which all of the other options are. The problem here is the compatibility issue it has with Smart Media. (To be fair, it looks like Multisite Global Media has compatibility issues with a number of other plugins and themes, which is ultimately one of the things that tipped me off that it was probably actually our media code that was triggering the issue.) In terms of getting us closer to the finish line with the use cases, it seems to me like this option might be closer to where we want to ultimately wind up than some of the other options.

I don't have a definite answer about which we should use. I'm leaning toward Multisite Global Media -- assuming we can get it to work with Smart Media. If we can't, either AMF or Network Media Library would work, it's just a matter of how we would want to approach some of the underlying infrastructure (I'm probably leaning slightly toward AMF between the two, mostly because it keeps the global files separate and untouchable from local sites, which I think ultimately we probably want).

@PriyaBhatia0210
Copy link
Author

Thanks @jazzsequence ! Brilliant work on the spike!!
Few questions that come to mind immediately:

Since there's only one file (excluding image sizes), it's always the one that's the most up-to-date.

Images uploaded to the global media site are canonical and can only be changed/updated from within the global site. Those changes exist everywhere in all contexts.

I take that none of the plugins is capable of version control in any form or manner. Do you confirm?

This is "a little of column a; a little of column b" as it doesn't strictly apply. First off, one cannot create and edit a media asset, at least not directly, and not from a client site. The media asset is either there (because it exists on the source) or it's not. An approach similar to Network Media Library could be used where a central media library site exists on a network and that's provided as the source, but that still excludes uploading to the source from the client site itself.

Does this mean I cannot create a picture and upload on my local to a central library at all and only use an external or pre-existing source? Is there a workaround?

you cannot upload to the global media library from a local site, only from within the global site

Not sure I understand this fully.

The metadata for a global image is not editable from a local site, only from the global site.

Can a global image be duplicated to local and then metadata be changed for the same?

I don't have a definite answer about which we should use. I'm leaning toward Multisite Global Media -- assuming we can get it to work with Smart Media.

From the above, I agree Multisite Global Media seems like a good fit for the use cases and future use-cases that i'd like to build out. However, I am skeptical of it breaking things with Smart Media. Will likely need more clarification on that. Is there a way to test this quickly without having to spend too much time building compatibility?

I'm probably leaning slightly toward AMF between the two, mostly because it keeps the global files separate and untouchable from local sites, which I think ultimately we probably want

Yeah this separation is nice to have and also being able to connect to other media sources is great. However, I am not too comfortable with how proprietary user generated content will be treated? How will that be made available globally? Consider this: An org has just one designer creating brand specific media file and wants that media file to be used globally. How will that work?

@jennybeaumont jennybeaumont modified the milestones: v7 sprint 2, v7 sprint 3 Mar 3, 2021
@roborourke
Copy link
Contributor

Yeah this separation is nice to have and also being able to connect to other media sources is great. However, I am not too comfortable with how proprietary user generated content will be treated? How will that be made available globally? Consider this: An org has just one designer creating brand specific media file and wants that media file to be used globally. How will that work?

I imagine they would just be given access to upload the global site.

It seems to me from what you've found so far Chris is that Multisite Global Media is a solid fit but in this landscape of integrations and an aim at providing frameworks I'm personally inclined to invest time into AMF. If that can provide multiple sources and if we can do some work to indicate the source of an image when browsing in the media library then I think it'll set us up really nicely for the future.

Another alternative could be a hybrid approach however, I'm not sure if it makes any sense or would even work but perhaps Multisite Global Media plus AMF is an option, where AMF is restricted to the global media site, and images are distributed from there. I think we'd still want the multiple sources capability with AMF though.

@jazzsequence
Copy link
Contributor

@PriyaBhatia0210 @roborourke and I chatted about next steps and decisions and came to a general conclusion. We will be going with Asset Manager Framework as the foundational component for a shared media library.

The reasons for this conclusion are largely influenced by:

  • the fact that it is built in-house,
  • it is itself a framework,
  • there is active development being done on it as well as a WordPress-specific source,
  • there is development and discussion about other features we'd need as well, for instance CRUD(Create, Read, Update, Delete) tasks like uploading to and deleting from the source and editing metadata and multiple providers,
  • it doesn't directly conflict with Smart Media out of the box (there are some integration concerns that would need to be resolved -- unlike Multisite Global Media, which gets us closer to the target initially but completely breaks if Smart Media is enabled)

AMF + the WordPress AMF source is not necessarily what we want the end result to be. There will be additional integration steps and potential features that we will need to build (or integrate existing work, if it's been done elsewhere) for an MVP shared media library feature. But we feel fairly confident that this should be possible with AMF under the hood, and that that would set us up better for the future than locking into an external plugin that we don't maintain that needs work to integrate with Altis out of the box (and likely continuous updates as their plugin develops).

@jazzsequence
Copy link
Contributor

jazzsequence commented Mar 4, 2021

New issues to be created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
must have Must be done, high priority
Projects
None yet
Development

No branches or pull requests

4 participants