Also, you're using the code for a PING))), which uses the same pin to trigger the device and receive the echo pulse, but you don't have a PING)))....you have an HC-SR04, which uses one pin to trigger and another to receive (in normal use).
Suggest using the NewPing library with your HC-SR04. And since inevitably the sensor will return erroneous values occasionally (such as zero), you should use NewPing's median method to help eliminate outliers. Or roll your own code to test for outliers.
Also, the photos don't show a connection between the HC-SR04 and the jumpers that plug into the breadboard (maybe they're hidden behind the HC?)
And, some of those jumpers aren't plugged all the way in. Plug 'em all the way in.