Skip to content

Commit

Permalink
Merge pull request #41 from sdapkus/master
Browse files Browse the repository at this point in the history
Added option to pass basename thru url parameter
  • Loading branch information
eduardokum authored Feb 23, 2022
2 parents ce9e67a + 475b86a commit 2713496
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 2713496

Please sign in to comment.