PARIS — A photo of five giant lobster tails, neatly encased in their shells and arrayed on a table sparkling with crystal and fine white wine, has exploded across the internet and endangered the career of a stalwart in the cabinet of President Emmanuel Macron of France.

François de Rugy, Mr. Macron’s ecology minister and the former president of the National Assembly, seemed like a strait-laced politician.

But he found himself in the public and political cross hairs on Thursday for a particularly sensitive transgression in today’s socially restless France: hosting lavish dinners for friends and relatives in the most sumptuous of settings, the Hôtel de Lassay, his official residence as assembly president, at taxpayer expense.

The lobster picture, publicized as Mr. Macron tries to regain his standing after months of populist fury at his policies and persistent image as “president of the rich,” was the last thing the president needed. The Yellow Vests rose up in revolt precisely over outrage at the perceived overprivilege of the Paris political and economic elite.