I do both, though I most often work from my imagination. Being human, however, I can’t retain everything, so there are times when I feel the need to supplement my mental image of an element or pose with more information. That can come from my own photos, outdoor sketches, or scrap file images I’ve saved and filed away, or images downloaded online.
For figures, if I’m having difficulty visualizing a pose I can pose myself or a model and work directly from life. (I have some big mirrors mounted in my larger studio room so it’s fairly easy for me to pose myself in the general attitude of the figure I need and work from that.) At other times I’ll photograph myself using a remote and dump the shots into iPhoto, run them in a slideshow on my laptop and work from those.
When I use photos, I look at several to get the gist of the light effect or manner in which the folds of the fabric are moving and then extrapolate and make up my own figure based on what I’ve learned. This is quite a bit different from tracing and/or trying to copy a photo, which rarely works. Photos can lie, but they do capture information about details. What you decide to do with them is part of what makes up your “style.” Painting from life can be part of the process, but I am more likely to work from a model in my studio for my personal work than for an illustration.
I’ve done a bare handful of paintings outdoors. Most of my work is painted in the studio using recollections form experiences outside. If I see a particularly compelling cloud or light effect during one of my excursions outdoors I’ll try to document it in acrylics on a small panel or card, usually about 5″ x 7″, and I’ll use these references at times.