The camera lens projects an image of the outside world onto the surface of film or digital imaging chip. The relationship between the actual size and the image size is a ratio. Also, the relationship between object distance and the focal length is a ratio.
We can draw imaginary lines from the boundaries of the object to center of the lens. These lines trace a triangle. Correspondingly, we can trace out a triangle from the boundaries of the image of the image object back to the center of the lens. Again a triangle shape is traced. The two triangles are “similar”, they have the same shape. All the corresponding angles are “congruent” and all the corresponding sides are “proportional”. Thus we can use a simple proportion to solve for image size and/or object distance.
As an example: An object 10 feet long is placed 50 feet from the camera. A 100mm focal length was used to take the picture of this object. How long is the image of this object? The ratio of the object’s length to the camera to subject distance is 10 ÷ 50 = 0.20. This object's image length will be 100mm X 0.20 = 20 mm long.
Using the same ration idea: A 100mm lens is used to image an object 10 feet long. The image of this object at the focal plane is 20mm long. The ratio of focal length to image length is 100 ÷ 20 = 5. How far away was the object? Answer 10 feet X 5 = 50 feet.