Integrating images into Anki card fields by tag number and image name

Hi all,
Have a bit of a specific question regarding being able to pull images into Anki card fields based on a tag name (have been unable to find the appropriate add-on, but I may be over complicating things). Here’s a simplified example to illustrate my question:

Let’s say I have a deck called fruits, where each card is based on a different fruit.
Let’s say these cards are tagged based on the colours of the fruits.
Let’s say I have image files saved that are the colours of these fruits.
Let’s say I want these image files to be uploaded in an extra field of the card in question based on the colour tag.

E.g. I have a plum card that is tagged purple. I have an image file purple.png . I want the plum card to have an extra field when I get the card right to show me the colour purple. I want it do this based on its tag as purple. Hope that makes sense.

Maybe you could try something like this:

  1. Wrap the entire Front/Back template with this div:
    <div class="{{Tags}}"></div>

  2. Add purple.png to the Back template, and assign an id to it, for example:
    <img src="purple.png" id="purple_image">

  3. Go to the Styling section and add this code:

#purple_image {display: none;}
.purple #purple_image {display: unset;}

This way, purple.png will be “hidden” by default, and will only be displayed when a note has the purple tag.

2 Likes

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