They sat on mattresses, in tents and shelters made of wooden pallets and draped with blankets to keep out the snow and the bitter wind that swept down Kensington Avenue. The cold, they said, was torture. But the pain of withdrawal was worse.

Since a Code Blue was declared last week — triggering increased outreach to people sleeping on the streets  — city officials have been working to get people inside as the temperatures plummeted.

But while they have largely managed to clear the streets in Center City, in Kensington it was a different story. There, officials are also battling an opioid crisis so entrenched, a disease so desperate, that many people in addiction would rather brave numbing wind chills than enter a shelter. In another indication of how the crisis has gripped the city, on Thursday afternoon, dozens remained under the train bridges on Lehigh Avenue, even as a winter storm battered the East Coast.

"I don't like using drugs so much that I want this to happen," said a man named George, wrapped in several layers of jackets under the Frankford Avenue bridge. "This is torture. This is absolute torture."

The city moved quickly this weekend in Kensington to get as many as people as possible inside. Last week, city officials saw that, despite the Code Blue, there were nearly 100 people still camped outside, said Alicia Taylor, the communications director for the Department of Human Services.

The bulk of the city's homeless resources are outside Kensington, with most shelters on Broad Street, or even farther away in Center City or West Philadelphia. And for some people in addiction, that's too far from their neighborhood, too far to stave off withdrawal.

So, as a part of a larger effort to address the opioid crisis, the city moved to find closer options  — at one point considering renting heated buses to park near the encampments. But they settled on the rec center at Lehigh and Aramingo Avenues, just a few blocks from the train bridges, and stressed that, like the city's emergency shelters, it does not require ID for entry.

From Saturday through Tuesday, some 75 people came through the rec center's doors. This week, the center opens every night at 10 p.m. and closes the next morning at 7 a.m. The local needle exchange, which opens its doors during the day, saw a few hundred come through on Wednesday. The count for Thursday was still being tallied. Anyone who shows up at the rec center before opening hours is offered a ride to another shelter.

"Our major concern was overnight hours, the most dangerous times," Taylor said. "The aim was to try to get them to come in, even if it really was for an hour. Just to come inside and sit and get warm."

On Kensington Avenue and under the train bridges, people paced to keep warm late Thursday afternoon. It was so cold that some sobbed with pain. Others warmed their hands around an ash-can fire that they said the police kept putting out. Outreach workers pulled up in cars with hot drinks and food.

"Have some coffee, my love," Kasey Fisher, who drives to the bridge encampment three times a week with tins of macaroni in her trunk, called to a man under the Emerald Street bridge.

A man who identified himself by his first initial, C, said he'd left the Kensington Avenue camp and gone to the warming center in desperation for a few hours the night before. It was crowded, and he argued with the man next to him, and ended up leaving. But the bridge was far worse.

"I hate this place," he said.

Still, a friend said, the needle exchange and the warming center were comforts. "It helps a lot," he said. "We can warm up, sleep, get our lives together, keep our stuff kind of safe."

Under the Emerald Street bridge, Tia, 25, said she'd spent the last night outside, tossing to keep warm under piles of blankets. She'd been sleeping outside since Halloween, she said.

"I can't go to my parents' house and wake up and do drugs," she said. "I don't want to disrespect my family."

But she said was going to see her father anyway Thursday night. She couldn't take another night outside.

At St. Francis Inn, the soup kitchen on Kensington Avenue, outreach workers handed guests handbills with directions to the warming center.

"We've been really pushing that," said Brother Fred Dilger, a Franciscan friar who works at the soup kitchen. "I think something like this  — where people can come and go more freely — is a good way to go."

Taylor said the warming center will remain open as long as a Code Blue is declared. All morning, she said, outreach workers had been driving people to shelters.

"It really was the difference between life or death," she said. "We have no doubt that we saved lives by opening this warming center."