Image in `collection.media` not showing in card

Hello there! I’m having an issue with Anki not rendering images even when they’re in collection.media.

I’m unable to have images I paste or images I insert via the clipboard button render in the card. It looks like this:
image

The card HTML has the correct file name of an image in collection.media. I can open the image in an external image viewer, and its filename matches to the one in the card HTML.

The card preview also does not show the image, nor does the card display it when I study the card.

I’m on Anki 2.1.60 on Manjaro Linux (installed from anki-bin in the AUR).

Thank you for your help!

This?

No, I’m using Basic Front/Back cards. The card template doesn’t have a type: in it, just {{Front}} or {{Back}}`.

Perhaps you’re missing a library like libpng. Maybe some text will be printed when Qt loads the png plugin:

https://docs.ankiweb.net/platform/linux/missing-libraries.html

Thanks for the doc link!

libpng wasn’t mentioned in QT_DEBUG_PLUGINS=1 anki, but mpv was. I installed both libpng and mpv for good measure, but images still don’t display.

You could try open the editor or review page in the web inspector, and then see if the image data is being sent in the network tab.

https://addon-docs.ankiweb.net/debugging.html#webviews

1 Like

Thanks for the pointer!

I opened the editor view in the debugger, and I noticed the image wasn’t requested in the Network tab. When I try to open the image address in a new URL (address was http://127.0.0.1:40459/paste-f8fb365a79c18feb2aa09f517d1637c913d39dc3.png, and paste-f8...png does exist in the collection.media folder), I see the following error:

send_file() got an unexpected keyword argument 'max_age'

It looked like a Flask problem of some kind - I looked up the version of Flask currently required by anki and upgraded. Images display now!

For others coming across this issue, upgrading Flask locally to whatever version is listed here should work!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.