Skip to content
This repository was archived by the owner on Jan 14, 2019. It is now read-only.

Commit bb91d43

Browse files
committed
allow to set basepath to look for images
1 parent 5cc8938 commit bb91d43

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/ImageEmbedPlugin.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@
1111
class ImageEmbedPlugin implements Swift_Events_SendListener
1212
{
1313

14+
private $basePath = '';
15+
16+
/**
17+
* ImageEmbedPlugin constructor.
18+
*
19+
* @param string $basePath
20+
*/
21+
public function __construct($basePath = '')
22+
{
23+
$this->basePath = $basePath;
24+
}
25+
1426
/**
1527
* @param Swift_Events_SendEvent $event
1628
*/
@@ -60,7 +72,7 @@ protected function embedImages(Swift_Mime_SimpleMessage $message, Swift_Mime_Sim
6072
*/
6173
if (strpos($src, 'cid:') === false) {
6274

63-
$entity = Swift_Image::fromPath($src);
75+
$entity = \Swift_Image::fromPath($this->basePath . $src);
6476
$message->setChildren(
6577
array_merge($message->getChildren(), [$entity])
6678
);

0 commit comments

Comments
 (0)