1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-10-10 19:32:07 +00:00

Merge pull request #5594 from wallabag/fix/download-image-overlapping

This commit is contained in:
Jérémy Benoist 2022-02-14 06:05:18 +01:00 committed by GitHub
commit 03e1fd6d73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 5 deletions

View file

@ -72,13 +72,16 @@ class DownloadImages
{
$imagesUrls = self::extractImagesUrlsFromHtml($html);
// ensure images aren't overlapping
arsort($imagesUrls);
$relativePath = $this->getRelativePath($entryId);
// download and save the image to the folder
foreach ($imagesUrls as $image) {
$imagePath = $this->processSingleImage($entryId, $image, $url, $relativePath);
$newImage = $this->processSingleImage($entryId, $image, $url, $relativePath);
if (false === $imagePath) {
if (false === $newImage) {
continue;
}
@ -87,7 +90,7 @@ class DownloadImages
$image = str_replace('&', '&', $image);
}
$html = str_replace($image, $imagePath, $html);
$html = str_replace($image, $newImage, $html);
}
return $html;