Custom image dimensions for each category

Hi everyone and happy new year 2020,

So I need to set up different image dimensions for each category of a website.

For example,

To set these dimensions for Category 1:

Catalog Images = 240 x 320px
Single Product Image = 470 x 627px
Product thumbnails = 75 x 100px

And these dimensions for category 2:

Catalog Images = 245 x 245px
Single Product Image = 470 x 470px
Product thumbnails = 75 x 75px

How to do this? Is there any code or filter to affect to that a named category to achieve these settings ?

Can we use the category ID and how to use it? I’m using woocommerce.

Thank you very much for the help.

Use classes.

Thank you for your reply.
How to use classes, please? Can you give me an example with the code’s syntax based on elements above and where to insert it.

give different class names to the various categories and kinds of images and set the desired dimensions in the css

I’m lost. “give different class names to the various categories and kinds of images and set the desired dimensions in the css”.

But how to do so? I can’t code. I’m not so techy to do such thing.

How to achieve custom image dimensions for each category?

Thank you for your aid.

I really encourage you to check out the CSS section of the freeCodeCamp curriculum.

Thanx for your replies,

As I said I can’t really code by my self.

You suggest to check ‘the CSS section of the freeCodeCamp curriculum’, could you provide a link to such resource?

Or also could you provide a straight code to set up this setting?

Thank you for your contribution.

Firstly, welcome to the forums.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. Some of what you are asking is pretty trivial in the Free Code Camp context, so you might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at https://www.freecodecamp.org/learn.

With your current questions, we don’t have enough context to know what you already know or don’t know, so it is impossible to guide you without just telling you the answer (which we won’t do).

It is pretty typical on here for people to share a codepen / repl.it / jsfiddle example of what they have tried so that anyone helping has more of an idea of what help is actually helpful.

Please provide some example of what you’ve tried and I’m sure you’ll get more help.

Happy coding :slight_smile: