How to alter image style based on product custom attribute?
You could use ImageCache Actions module
and write your PHP field condition right on the generation of the image.

Custom Actions effect is what you need.