Nextcloud images not displaying in Discourse

This url should embed the linked image directly into this post…

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

This is default behaviour of Nextcloud, which does not work within Discourse for some reason. It is discussed on the Nextcloud forum here. Thanks for any guidance or suggestions!

1 Like

I think we need an extension for images.

You need to explicitly tell it is a image if it has no image extension:

markdown:

![image](upload://v3ysVDuCq4lG7rPu28etHkdM2Pw.jpeg)
becomes

BBCode:

![](upload://v3ysVDuCq4lG7rPu28etHkdM2Pw.jpeg)
becomes

Or cheat with some query string:

https://cloud.disroot.org/s/RSZgiiS4AmpicEF/preview?format=.jpg
becomes

6 Likes

That sounds right, but this https://photos.app.goo.gl/3pCSTfcPgEdgnv1H8 does this:

Google Photos

1 Like

Now you are comparing :apple: to :banana:.

NextCloud example response is a real image, with the appropriate Mime type and everything.

Your example is an HTML document! This HTML document has a dedicated engine for oneboxing at onebox/lib/onebox/engine/google_photos_onebox.rb at main · discourse/onebox · GitHub.

5 Likes

Oops. That explains it. I guess I am :banana:!

3 Likes

What’s the status on this? I’d love to be able to just dump a nextcloud link and then see it as a picture in discourse! I suppose we need a button in nextcloud which copies the preview link with added ?format=.jpg by default in the sharing tab?

I’d like to be able to do this too. Hmm.. let me do a test. Ok, when I get the sharing link and paste it, it becomes oneboxed. This is fine for me, though of course it would be nice if it showed up more prettily.

https://nextcloud.kb2.org/s/KRj8rtwaL5wFraT

Here’s the same image with the ?format=.jpg appended.

Nextcloud can fix this by setting a proper og:type meta tag. Currently it is set to object. If it was set to image onebox would treat it as such.

5 Likes

https://github.com/nextcloud/photos/issues/1082

2 Likes