diff --git a/bridges/VkBridge.php b/bridges/VkBridge.php index 13fad14a..1c266b3e 100644 --- a/bridges/VkBridge.php +++ b/bridges/VkBridge.php @@ -304,8 +304,30 @@ class VkBridge extends BridgeAbstract } $item = []; - $item['content'] = strip_tags(backgroundToImg($post->find('div.wall_text', 0)->innertext), '
'); - $item['content'] .= $content_suffix; + $content = strip_tags(backgroundToImg($post->find('div.wall_text', 0)->innertext), '

'); + $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