The officer, normally assigned to the Sixth Precinct in the West Village, readily recalled the encounter. “It was freezing out and you could see the blisters on the man’s feet,” he said in an interview. “I had two pairs of socks and I was still cold.” They started talking; he found out the man’s shoe size: 12.

As the man walked slowly down Seventh Avenue on his heels, Officer DePrimo went into a Skechers shoe store at about 9:30 p.m. “We were just kind of shocked,” said Jose Cano, 28, a manager working at the store that night. “Most of us are New Yorkers and we just kind of pass by that kind of thing. Especially in this neighborhood.”

Mr. Cano volunteered to give the officer his employee discount to bring down the regular $100 price of the all-weather boots to a little more than $75. The officer has kept the receipt in his vest since then, he said, “to remind me that sometimes people have it worse.”

The photo was taken by Jennifer Foster, a civilian communications director for the Pinal County Sheriff’s Office in Arizona. She said the moment resonated for personal reasons: She remembered as a young girl seeing her father, a 32-year veteran of the Phoenix police force, buy food for a homeless man.

“He squatted down, just like this officer,” she said.

After returning from vacation, she described the picture in an e-mail to the New York Police Department, thinking of it as a sort of a compliment card. She never expected the picture to end up online — “I’m not on Facebook,” she said — but a department official e-mailed her and asked if she would send along the photo so it could be posted.

As for the man he helped, Officer DePrimo never got his name, and he could not be immediately located on Wednesday. “He was the most polite gentleman I had met,” the officer said, adding that the man’s face lit up at the sight of the boots. Officer DePrimo offered him a cup of coffee, but “as soon as the boots were on him, he went on his way, and I just went back to my post.”