Skip to content

Commit

Permalink
fix: og img conflicts with img proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
zgq354 committed Sep 29, 2024
1 parent 7cba33d commit 5f3dd6b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Extend/ImageSize/FormatImgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ private function processAttributes($url, $attributes) {

private function processImageProxyAttributes($url, $attributes) {
$newUrl = $this->getImageProxyURL($url);
$attributes['src'] = $newUrl;
/**
* hack: getImageProxyURL 生成的非 png / jpg 的 url 中没有 .jpg 的后缀,导致 seo 插件识别 og:image 生成有误,不想去改它正则,这里加一个 hack 骗过正则检测
* @url https://github.com/v17development/flarum-seo/blob/2091f651cde88fccf4ddc49d97ed33cbad44200e/src/Listeners/PageListener.php
*/
$attributes['src'] = $newUrl.'?.jpg';
$attributes['url'] = $newUrl;
$attributes['origsrc'] = $url;
return $attributes;
Expand Down

0 comments on commit 5f3dd6b

Please sign in to comment.