perf: 优化图文消息

This commit is contained in:
kuaifan 2025-02-25 17:38:12 +08:00
parent a1920745fb
commit 94932c7486

View File

@ -899,8 +899,12 @@ class WebSocketDialogMsg extends AbstractModel
$imageSaveLocal = Base::settingFind("system", "image_save_local");
preg_match_all("/<img[^>]*?src=([\"'])(.*?(png|jpg|jpeg|webp|gif).*?)\\1[^>]*?>/is", $text, $matchs);
foreach ($matchs[2] as $key => $str) {
$parsed = parse_url($str);
if (str_starts_with($parsed['path'], "/uploads/")) {
$str = "{{RemoteURL}}" . ltrim($parsed['path'], "/");
}
if ($imageSaveLocal === 'close') {
$imageSize = getimagesize($str);
$imageSize = @getimagesize($str);
if ($imageSize === false) {
$imageSize = ["auto", "auto"];
}