You can also make what’s called a clipping group, which is nice because the type can be live.
Type your text.
Get your photo situated in the layer above the text layer.
in the Layers palette, option click on the border between the two layers. The photo should then be clipped by the contents of the text layer.
—
This method isn’t limited to text layers – any kind of layer can be used to clip another.