mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-22 17:45:40 +03:00
[VkBridge] Photo fixes (#3039)
This commit fixes following issues: - Photos from user profile wall started appearing as blured - On posts with photo collection small thumbnails are shown
This commit is contained in:
parent
a1e229a7e1
commit
11220ef373
1 changed files with 24 additions and 2 deletions
|
@ -304,8 +304,30 @@ class VkBridge extends BridgeAbstract
|
|||
}
|
||||
|
||||
$item = [];
|
||||
$item['content'] = strip_tags(backgroundToImg($post->find('div.wall_text', 0)->innertext), '<a><br><img>');
|
||||
$item['content'] .= $content_suffix;
|
||||
$content = strip_tags(backgroundToImg($post->find('div.wall_text', 0)->innertext), '<a><br><img>');
|
||||
$content .= $content_suffix;
|
||||
$content = str_get_html($content);
|
||||
foreach ($content->find('img') as $img) {
|
||||
$parsed_src = parse_url($img->getAttribute('src'));
|
||||
|
||||
// unblur images (case of impf)
|
||||
// get original images instead of thumbnails (case of impg)
|
||||
$imgPrefix = array_reduce(['/impf/', '/impg/'], function ($a, $c) use ($parsed_src) {
|
||||
if ($a) {
|
||||
return $a;
|
||||
}
|
||||
if (str_starts_with($parsed_src['path'], $c)) {
|
||||
return $c;
|
||||
}
|
||||
return $a;
|
||||
}, '');
|
||||
if ($imgPrefix) {
|
||||
$new_src = $parsed_src['scheme'] . '://' . $parsed_src['host'];
|
||||
$new_src .= substr($parsed_src['path'], strlen($imgPrefix) - 1);
|
||||
$img->setAttribute('src', $new_src);
|
||||
}
|
||||
}
|
||||
$item['content'] = $content->outertext;
|
||||
$item['categories'] = $hashtags;
|
||||
|
||||
// get post link
|
||||
|
|
Loading…
Reference in a new issue