Add local images to cards created with iOS Shortcuts

Hello!

I am looking to automate my workflow of creating flashcards from physical paper manga with iPhone/iPad.
I have a Shortcuts script that takes the word, looks it up and downloads the relevant definitions. I would love to be able to also include a photo of a manga panel i am remembering.
From what I see, I can create a card using anki://x-callback-url/addnote?, and there is a section in the manual saying that i can use links to online images to be included. Can I do the same with locally saved photos?

I had a few approaches in mind:

  1. Pass an absolute path to the image using file:// (that would for instance be stored in “Recent” folder) and have AnkiMobile import it the same way as it would an online image.
  2. Manually copy an image to Anki’s media folder and just pass the name of it as all the regular cards.
  3. Pass the image in base64 and render it directly.

I haven’t managed to make it work using any of above, so I am assuming that either AnkiMobile is not supporting such interferences or I just did something incorrectly.

  1. Just ended up as a plain string in the card, so i am assuming only https:// urls are recognized? Or maybe it’s a permissions issue?
  2. I am not sure if it is possible to access the media folder manually. Does AnkiMobile have any functions to add images?
  3. It didn’t work for me from the box, but I could probably modify the note template to treat all images as base64 and render them as such by default. But that would interfere with me also using Anki on desktop, where i would paste images the classic way.

Does anyone have ideas if something like that can be achieved?

You should already be able to use base64 images. For example:

anki://x-callback-url/addnote?deck=default&type=basic&fldFront=abc&fldBack=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII=
1 Like

Works perfect, thank you so much!