Apollo Global Management LLC is buying Shutterfly Inc. and Snapfish LLC, which the private-equity giant plans to combine to create a bigger player in online-photo services.

The deal for Shutterfly values the photo-book manufacturer and retailer at $51 a share, or about $1.7 billion, the companies said Monday. The purchase of Snapfish, which like parent District Photo Inc. is closely held, would be contingent on the Shutterfly acquisition closing. District Photo would end up with a substantial minority stake in the combined company. The Wall Street Journal earlier reported details of both deals.

Shutterfly also announced the appointment of Ryan O’Hara as its president and chief executive officer.

Mr. O’Hara will be joining the company from Realtor.com owner Move Inc., effective June 24. Journal parent News Corp also owns Move.

In February, Shutterfly said its board had formed a strategic review committee and hired Morgan Stanley after being approached by a third party about a potential deal. The company also said at the time that Chief Executive Christopher North would be stepping down at the end of August.