The pictures show men leaning over huge trenches without any protective clothing while laying the foundations of a family home at Gilbraltar Lane, Denton.
Manchester Magistrates' Court heard the excavation was so deep it undermined a neighbouring house, leaving it at risk of collapse.
The court was told that between 2019 and 2020 principal contractor Mustapha Matib employed several groundworkers to excavate land at Gibraltar Lane for the construction of a family home.
But after neighbours raised concerns a health and safety inspection was carried out and work stopped when "serious fall" and "potential collapse" risks were found.
The Health and Safety Executive found Matib had failed to prepare risk assessments and method statements detailing how the work would be safely carried out.
He failed to appoint a site manager with suitable skills, knowledge and experience and failed to ensure the health, safety and welfare of the workers.
The site was not secured to prevent trespassers and a neighbouring house had been undermined with parts of the property at risk of collapse due to the excavation work.
Matib of Allerton Road pleaded guilty to breaching regulations and was given a 16-week prison sentence, suspended for 12 months, 200 hours community service and ordered to pay costs of £5,673.
Speaking after the hearing, HSE inspector Phil Redman said: "Inspectors will not hesitate to take appropriate enforcement action against duty-holders who fall below the required standards and put lives at risk."