Is there a good way to use CMS images with CSS

The best way I found to solve this issue was to have PHP write the CSS styling I needed in-line. I know it is not best practice in terms of maintainability as it might be confusing to someone else coming into the project later on.

However, it was a personal site so I will be the only one updating it. And it was the simplest solution to accomplish my needs. Hopefully there will be some kind of standards compliant solution to this in the future but for now this was the best I could come up with.