diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper/DownloadImages.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/DownloadImages.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/DownloadImages.php b/src/Wallabag/CoreBundle/Helper/DownloadImages.php index 004bb277..e7982c56 100644 --- a/src/Wallabag/CoreBundle/Helper/DownloadImages.php +++ b/src/Wallabag/CoreBundle/Helper/DownloadImages.php | |||
@@ -15,6 +15,7 @@ class DownloadImages | |||
15 | private $baseFolder; | 15 | private $baseFolder; |
16 | private $logger; | 16 | private $logger; |
17 | private $mimeGuesser; | 17 | private $mimeGuesser; |
18 | private $wallabagUrl; | ||
18 | 19 | ||
19 | public function __construct(Client $client, $baseFolder, LoggerInterface $logger) | 20 | public function __construct(Client $client, $baseFolder, LoggerInterface $logger) |
20 | { | 21 | { |
@@ -27,6 +28,17 @@ class DownloadImages | |||
27 | } | 28 | } |
28 | 29 | ||
29 | /** | 30 | /** |
31 | * Since we can't inject CraueConfig service because it'll generate a circular reference when injected in the subscriber | ||
32 | * we use a different way to inject the current wallabag url. | ||
33 | * | ||
34 | * @param string $url Usually from `$config->get('wallabag_url')` | ||
35 | */ | ||
36 | public function setWallabagUrl($url) | ||
37 | { | ||
38 | $this->wallabagUrl = rtrim($url, '/'); | ||
39 | } | ||
40 | |||
41 | /** | ||
30 | * Setup base folder where all images are going to be saved. | 42 | * Setup base folder where all images are going to be saved. |
31 | */ | 43 | */ |
32 | private function setFolder() | 44 | private function setFolder() |
@@ -143,7 +155,7 @@ class DownloadImages | |||
143 | 155 | ||
144 | imagedestroy($im); | 156 | imagedestroy($im); |
145 | 157 | ||
146 | return '/assets/images/'.$relativePath.'/'.$hashImage.'.'.$ext; | 158 | return $this->wallabagUrl.'/assets/images/'.$relativePath.'/'.$hashImage.'.'.$ext; |
147 | } | 159 | } |
148 | 160 | ||
149 | /** | 161 | /** |