Here's how I do it in photoshop:

1. Type the letters
2. Paste the image on top of the letters
3. Lower the opacity of the image a little bit so you can see the letters
4. Place the part of the image you want to see over the letter you want it in
5. Raise the opacity of the image back to 100%
6. Go to the layers palette. Press ctrl and click on the letters layer. This should select the letters.
7. Now click on the image layer (don't press down on ctrl)
8. Right click and select "select inverse"
9. Press backspace.
10. Voila!

If you want a "border" around it, you will need to press ctrl and click on the image layer in the layers palette. Then go to edit -- stroke. Select the color you want and select "outside". Enter in a thickness and press okay. Unselect the image.