ERR_TOO_MANY_REDIRECTS for image previews

Hello,

we try to use Nextcloud to serve images and display image previews on a web page. Thumbnail URL example looks like http://cloud.interfonica.ru/apps/files_sharing/publicpreview/H8pTCYn8mQnSMKW?x=50&y=25&a=true

When you open this URL in the browser directly, you see the thumbnail picture OK. But if it’s used in img tag as src attribute, we get just ERR_TOO_MANY_REDIRECTS error in console.

What is the correct HTML to include Nextcloud image preview to a web page?

More details: when browser tries to download image as IMG SRC, Nextcloud returns 302 and no image. We open the same URL in the browser and see there is a picture. Then we refresh our page and Nextcoud returns an image for IMG SRC with code 200!
That’s a bit strange.

I think you must use the app “SharingPath”. Because the user is in the CDN-path perhaps use a special nextcloud-user for nice path-names instead of “admin” in the example.

Unbenannt

https://apps.nextcloud.com/apps/sharingpath

I think also this does not work in img-html-code

http://cloud.interfonica.ru/apps/files_sharing/publicpreview/H8pTCYn8mQnSMKW?x=1440&y=414&a=true&file=4be4c2a1-68c3-4ca8-8113-f07dae54aef0.png

OK the big question here is: what is the correct way to make a thumbnail URL for an image knowing its ID and preview width/height? It’s NOT for admin so should be accessible without login and used on a webpage as SRC in the image.