Skip to content

Commit

Permalink
Added option to pass basename thru url parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
sdapkus committed May 13, 2021
1 parent 06518c1 commit 475b86a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Embedder/AttachmentEmbedder.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,12 @@ public function fromRemoteUrl($url)
if ($httpcode == 200) {
$pathInfo = pathinfo($url);

$queryStr = parse_url($url, PHP_URL_QUERY);
parse_str($queryStr, $queryParams);
$basename = $queryParams['basename'] ?? $pathInfo['basename'];

return $this->embed(
new Swift_Image($raw, "{$pathInfo['basename']}", $contentType)
new Swift_Image($raw, "{$basename}", $contentType)
);
}
}
Expand Down

0 comments on commit 475b86a

Please sign in to comment.