Star Rating and if condition for images

I want to create a star rating but with images of the stars, i did exactly like the tutorial that works with the icon but its not working because of the format of the image.

Please any help to solve this and thanks