Nextcloud images not displaying in Discourse

סיכום מבוסס בינה מלאכותית

The issue of Nextcloud images not displaying in Discourse is being discussed. sunjam shared a link that should embed an image directly into the post but doesn’t work in Discourse. Falco suggested that an extension for images is needed or that the link needs to be explicitly marked as an image.

Falco explained that Nextcloud links don’t work because they don’t have the correct MIME type, unlike pfaffman’s Google Photos example which is an HTML document with a dedicated oneboxing engine.

The discussion continued with microfx and tobiaseigen who would like to see a more straightforward solution, such as a button in Nextcloud to copy the preview link with an added ?format=.jpg parameter. Falco suggested that Nextcloud could fix the issue by setting a proper og:type meta tag to image. sunjam shared a related Nextcloud issue on GitHub.

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

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 לייקים

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

Google Photos

לייק 1

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 לייקים

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

3 לייקים

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 לייקים

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

2 לייקים