One image for multiple categories

Good day,

I have a question if it’s possible to upload one image for a category and use that same uploaded image for the subcategories and subsubcategories. Below is the structure

Category A
    Category A1
    Category A2
    Category A3
    Category A4

Category B
    Category B1
        Category B11
        Category B12
    Category B2
    Category B3
    Category B4
        Category B41
        Category B42

Category C
    Category C1
        Category C11

Category D
    Category D1
    Category D2
    Category D3
    Category D4

Categories A…D have an image for the category. Navigating to the first level shows the image of that category, going to the 3rd level does not show the image so I have to add it manually. I unfortunately have a lot of categories (not my choice) so it’s a lot of work and it eats disk space on the server (call me old-fashioned, I’m used to working with stuff with very limited resources).

Inheritance would be first price. Other ways to achieve that I only need to upload the image once and preferably not have to edit every subsub category?

Note that I’m a total beginner with Discourse, currently revamping an existing Discourse based site.

Thanks in advance.

It does not. Images are stored by a hash, so only a single copy will be created/stored no matter how many times it’s uploaded.

If you have access to rails you can do something like this:

children.update_all(uploaded_logo_id: parent.uploaded_logo_id);

The trailing semicolons keep rails from putting the output in a viewer, so you can paste all three lines at once. You might omit them when you try this out. You should make a backup and be willing to restore it if you’re not trying this first on some kind of test or staging site.

You can suggest that your overloards read It’s Time We Talked About Tags. Or maybe there is some good reason for all of the subcategories. Unless you need to limit access to those subcategories or people will want to watch/mute those categories, they are probably doing to make things worse for everyone (except the person who gets bragging rights that their bad idea was the one that was accepted by the Whole Company).

1 Like

Thanks for the reply

That’s great, one worry less.

I only have access to the staging website (hosted by Discourse); so I doubt I have access to Ruby :wink:

In that case you could contrive to do something similar with the API, but you’re on your own for that. You’d start with Reverse engineer the Discourse API. . .

Hey listen, I said that I was a beginner :rofl:

Thanks for the two links that you’ve provided :+1:

1 Like

Yeah. Sorry. Unless you’re already good with interacting with an API (maybe with curl) then I’m afraid you’ll just have to do a bunch of clicking.

1 Like