Hi Andrea. What you need to do is modify this line:
$custom_image_ids = array(2,8,28,617);
with your own category numbers.
For example: imagine that you have 4 categories and that you wish to display custom images for 2 of those. So, you need to retrieve the category ID for each targeted category and add those IDs as comma-separated values. Assuming the IDs of those two categories were 57 and 324, your $custom_image_ids
definition should look like this:
$custom_image_ids = array(57,324);
Remember to follow the instructions carefully regarding parent and child categories.
Cheers!