Pixels, DPI, and file size without the folklore

DPI is a label that tells a printer how to spread pixels across paper. It does not add pixels. A 600×400 image at 300 DPI is a small print. The same image at 72 DPI is a larger, softer print. The file did not gain detail.
What to measure
Measure pixels first. Width times height, divided by the DPI you intend to print, is the print size in inches. Multiply inches by 2.54 for centimeters. The photo size calculator on this site does that arithmetic and can read the pixel size from a file without uploading it.
Screens do not use DPI the way printers do
On a website, the pixel dimensions and the file weight matter. A 300 DPI tag on a JPG does not make it sharper in a browser. Compress for the page. Keep a larger original if you might print later.
When the number is not the problem
If the long edge is already short, no DPI setting will make a crisp poster. You either print smaller, photograph again, or accept a soft enlargement. The upscaler can make a larger file for a layout. It cannot photograph the scene a second time.