Looking for an offensive boost, the Philadelphia Phillies added an All-Star who may not help them for a while.

The NL East-leading Phillies acquired injured catcher Wilson Ramos from the Tampa Bay Rays on Tuesday for a player to be named or cash. They also got left-hander Aaron Loup from the Toronto Blue Jays for minor league right-hander Jacob Waguespack.

Ramos is batting .297 with 14 homers and 53 RBIs but is on the disabled list with a left hamstring strain. General manager Matt Klentak said the best-case scenario has Ramos returning in mid-to-late August, though it’s possible he may be sidelined until September.

“We’re uniquely positioned to take on a risk like this,” Klentak said in a conference call. “The fact he may not be active for a few more weeks is not the end of the world for us.”

Ramos said he can do everything behind the plate but still feels pain when he runs.

When healthy, Ramos should upgrade an offense that has struggled during a four-game losing streak. He’s also solid defensively.

“Wilson Ramos is a proven commodity, both behind the plate and at the plate, and also as a teammate,” Phillies manager Gabe Kapler said.

Ramos, who turns 31 next month, has a $10.5 million salary, and the Phillies will be responsible for the remaining $3,443,548. He has 315 plate appearances and can earn $250,000 each for 450, 475 and 500.

“My first reaction was surprise,” Ramos said of the trade. “I was reading a lot of news, but as soon as they told me I was traded to the Phillies, I was happy at the moment but sad at the same time. Happy because that team is in first place and I can do a lot of things to help that team win a lot of games. And sad because I’m very thankful with this team because they helped me a lot. They trust me, give me a contract (after knee surgery in 2016). Now, I’m going to Philadelphia and trying to help that team win the World Series.”

Kapler happy with moves: The Phillies already added more pop when they acquired infielder Asdrubal Cabrera from the New York Mets last Friday.

Kapler said he’s happy the team got stronger “without sacrificing our future to a large degree.”

Loup has a 4.54 ERA in 50 relief appearances this season with 42 strikeouts in 35 2/3 innings, and the Phillies will assume the $594,422 remaining of his $1,812,500 salary.

Waguespack was 4-6 with a 4.68 ERA in 21 games, including 15 starts, at Double-A Reading and Triple-A Lehigh Valley.

“Our bullpen has been among the best in baseball in July,” Klentak said. “Loup is really good against left-handed hitters. What he can do against lefties to neutralize them is important and something we haven’t had this year.”

Infielder Trevor Plouffe and lefty Zach Curtis were designated for assignment to make room on the 40-man roster.