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.

5 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…

1 Like

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…

I have a similar use case that I don’t know if it works or how to get it work.

I have some videos on my nextcloud instance, that people collaboratively produced. Now it would be great if they could embed the public share-link from the video on nextcloud in their respective drupal or wordpress blogs.
At least for drupal I know there is a module to allow to add custom oembed providers; but I cannot figure out from the discussion above whether nextcloud allows or is capable of providing embed-able content, and if so, how to achieve this.

You can embed a Nextcloud hosted video in WordPress using the Nextcloud download link. It’s pretty straightforward. You can use a Video Block or HTML.

From the public share (eg. https://nextcloud.example.com/s/FGZbJ37EzDQ2P4d), get the download link (eg. https://nextcloud.example.com/s/FGZbJ37EzDQ2P4d/download).

You can use the download link as the source URL for a Video Block.
It will produce the following video html tag :

<video controls src="https://nextcloud.example.com/s/FGZbJ37EzDQ2P4d/download"></video>

You can as well put the video tag yourself in a Custom HTML Block.

1 Like

A decent alternative is to use HTTP and let the files be served by your web server! Store your public files in a folder in your Nextcloud public root so they are available by HTTP (eg. https://nextcloud.example.com/public/), then set an local external storage in Nextcloud to the path of that folder. Since it’s right into your Nextcloud root, there should not be any file permission issues. You can even organize them in folders if you wish.

Everything in that folder will be directly available to the Internet. You can then embed any media file from that folder anywhere you want.

I think it could be possible with this app Sharing Path - Apps - App Store - Nextcloud I remember vaguely that I once tried it and that it worked

Created myself a WordPress plugin to connect external services as files / directories inside WordPress. The sources are kept stored on the remote location. But it is possible too to import them into WordPress. [visa versa too]

Sorry to let you know I am not publishing my own Plugins on the WordPress Plugin pages because the whole process of accepting isn’t it worth for me.

If you are interested … Just let me know. Maybe we are able to work something out.

For now … Enjoy your weekend!

2 Likes

Hi there,

Do you still have the plug-in? I’m interested in it.

Regards

some interest in your plugin was shown in the message above. maybe instead you would be interested in uploading it to the Nextcloud app store?

2 Likes

I was using the external image plugin for WordPress in the past, but was finding relying on external nextcloud introduced latency, which I resolved by moving everything local to WordPress. Curius about the plugin!

Hello there, sorry to reactivate this old post, but it seems it has been done already several times. :slight_smile:

There’s an integration with WordPress here with this (commercial plugin): Nextcloud integration with the WordPress media library

Cheers,

2 Likes