A point of confusion is how programs like Adobe Photoshop presents the image size. It is the miscomprehension of this presentation that has often led to the erroneous belief that the ppi/dpi number in a digital photo somehow relates to digital image resolution/quality.
The following image is of the "Adobe Photoshop > Image > Image Size" dialog box (Adobe Photoshop CS5) as it might typically look when you load in a photo directly from your camera.
In the top part, in the Pixel Dimensions section are the number of pixels that make up the horizontal and vertical dimensions of the image. In this case 5184 pixels horizontally by 3456 pixels vertically. If we multiply those two numbers together we get 17,915,904 - or 17.9 megapixels (Mp). This is the digital resolution of the image (and why camera manufacturers use it to show the resolution of a camera - in this case 18 Mp). Ignore the number shown after Pixel Dimensions: (51.3M) for now, it's not germane to this discussion, but I'll tell you what it is at the end of this article
The next section Document Size is where the confusion lies and miscomprehensions start. The Document Size is the size of the paper required to print that digital image at the pixels per inch (ppi) shown in the "pixels/inch" section. In the case of the image above, if that digital image was printed at 72 pixels per inch, it would require a paper size of 72 x 48 inches. The word "Resolution" in that section means paper ppi resolution when printed - NOT the digital resolution of the image.
In this image we see a different number in the Document Size "Resolution". To get here, I've de-selected "resample" image and then I've changed the resolution section from 72 to 300. The Document Size size now shows 17.28 x 11.52 inches. Many people jump to the (erroneous) conclusion that since the Document Size has changed, that their digital image has changed. It's not true - the digital image has not changed, the pixel dimensions remain the same. That's because the "resample" image box has been de-selected, the only thing that's changed is the conversion factor that is used to show what paper size would be required to print that image at the specified ppi - in these two cases, either 72 or 300. This leaves the pixel dimensions unchanged and hence the digital resolution of the photo remains unchanged. If you saved these images to disk, one with 72 ppi and one with 300 dpi, the images will be identical except for those two numbers.
If you print this image, either set at 72 ppi or 300 ppi (or any other ppi) to 6" x 4" paper, it will always be printing at 864 pixels per inch (5184 pixels divided into 6 inches = 864 pixels per inch). The ppi number in the "resolution" box of the document size section doesn't matter in this case - 5814 pixels printed to 6 inches is always going to be 864 ppi.
So, for digital photographers, the "document size" section is there simply for your convenience, to see what the paper size might be if you printed to a specified ppi. If you don't have the re-sample box checked and the pixels dimensions remain the same, the digital resolution remains the same no matter what number you park in the "Resolution" section in Document Size.
Why is the Image Size Dialog Box like this?
There are a couple of reasons. One is a legacy of when that number (as dpi, not ppi) could be used to set the printer's output. The other is the background of Photoshop as both a digital image editing program and as a graphics arts creation program.
In the graphics arts world (and please note, this website is about digital photos, not graphics arts), many designers work with "virtual paper" and in this case it does help to virtually paper size an image to the dimensions that are required. In our example, if we wanted that image to fit 6" x 4" of virtual paper, we could set the ppi to 864. When that image is imported into many graphics arts programs, it will then default to a virtual paper size of 6" x 4". If a graphic artist is working with many images and doesn't want them any bigger than they have to be (trying to keep the overall filesize down), the image can be resized down to their desired ppi number (usually 300) using this section of the dialog box.
Can the "Document Size" section be used productively by the digital photographer?
Yes, for a couple of reasons. Although I strongly recommend that this section of the Image Resize dialog box not be used for digital photo resizing/resampling (it's best to use the pixel dimensions section), as noted above, it can be used to re-size/resample the image.
It can also be used to determine the maximum size of paper at your preferred printing ppi. So, if you want to know how big you can print at 200 ppi, just stick 200 in the ppi section (after having de-selected resample) and you'll get your answer (in our case, the answer would be 25.92" x 17.28"). All Photoshop is doing is dividing by pixel dimension (in this case 5184 x 3456) into the ppi number. You can do exactly the same with a calculator.
And, of course, sometimes you may have to change the number in that section to 300, in order to make the photo acceptable to those who don't know that it doesn't matter what number is in this section. See the Change DPI Page.
Pixel Dimensions: 51.3M
It's not really part of this discussion, but for the sake of completeness, what does the number 51.3M shown at the top after Pixel Dimensions mean. Adobe is less than clear on this, but it appears to be a calculated uncompressed size (in kilobytes or megabytes) of the image. For this RGB image, it is calculated with the formula (H.pixels*V.pixels*3)/1048576. The 3 multiplier is for the 3 RGB channels. The number 1048576 (10242) is how many bytes there are in a megabyte and hence converts the result to megabytes, in this case 51.25781, which, rounded up, equals 51.3 megabytes. With a CMYK image, the formula would be the same, but multiplied by the 4 colour channels, which, for this image, would result in 68.3M. It doesn't actually mean much, but if you save the file as an uncompressed TIF file, you'll get close to this filesize. A compressed TIF or a JPEG will be much smaller in filesize. See the Digital Image Filesize section on the filetypes page for a comparison of how my bytes it takes to store a digital image.