Would it be possible to use Nextcloud as a Wordpress media repository?

I’ve searched through the Wordpress plugins and there is nothing like this, but I think it would be great to be able to connect a Wordpress blog (self-hosted or not) to a Nextcloud server.

I mean something like https://wordpress.org/plugins/cbxdropboxfilechooser, which supposedly enables inserting files from that cloud in your blog.

My use case is this: I have a blog hosted in a shared server, and I had not too much disk space. Whenever I wanted to insert an image, I had to upload there. But, as I have a home Nextcloud server, I’d like to use the files directly from within it, as it would save me a lot of disk space in the hosting.

It would one of those little things that help spreading the word.

3 Likes

If there are plugins for webdav, they should work with Nextcloud.

1 Like

As I understand it you want serve the media files directly from the nextcloud. With webdav you access the files, but not publish them.
We are now thinking about a preview API to serve images https://github.com/nextcloud/server/issues/2523

This could be used for the publishing part.

Yes, I was thinking about something like this. I’ll follow that issue. Thanks!

Following …

Also following. I would really like to see this feature. The WP developer and user community is HUGE and I know many WP devs who would love to have a feature like this and allow them to do away with subscriptions etc to Amazon or Dropbox.

This would literally be a game changer for WP development, literally.

Picture previews is working via Nextcloud. Share the link, add /preview to the end of the url and viola…

https://cloud.disroot.org/s/RSZgiiS4AmpicEF/preview

…err, or not. Discourse won’t embed the image above…

I don’t think that exactly meets the functionality for batch uploading stuff to Wordpress though right? At least in my understanding the way that I would want to use it, is for it to allow me to have a synced NextCloud folder on my computer that I could just drop a batch of photos to and they would sync to a folder on my NextCloud Folder which could then get auto uploaded into my WP media library. This wouldn’t be the same thing in my mind as just using NextCloud as an FTP upload either, since most WP websites make extensive use of caching, automatic image transformation, and CDN, so while you might want to use NC to upload your files to WP you wouldn’t actually be calling them from the NC server via preview urls etc.

I mean that’s my take on it. I’m by far the least experienced dev here!

FWIW, I can’t even get NC to embed even one of my pictures in my WP blog, much like @just tried above. I don’t think it can ever act as a repository, which means that I have to spend double storage for having one file in NC for myself, and displaying it via WP.

EDIT:

Does [Embedding] Work With Any URL?

No, not by default. WordPress will only embed URLs matching an internal whitelist. This is for security purposes.

Adding support for an additional website depends on whether the site supports oEmbed. If a site supports oEmbed, you’ll want to call wp_oembed_add_provider() to add the site and URL format to the internal whitelist. Otherwise, you’ll need to register a handler using wp_embed_register_handler() and provide a callback function that generates the HTML.

WordPress Docs - Embed

So I guess, does NC have oEmbed (whatever that is)?

And how can I use them?

EDIT2:

A couple open issues on this:


On this regard I would like to know if this usercase could be interesting: I would like to link a radio recording file that I have stored on a hosted nextcloud instance from a page on wordpress. This would allow me to spare space on the webserver.
Would it be possible in your opinion? Is .ogg and .mp3 files…