mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-28 04:40:37 +00:00
perf: 优化编辑带有图片的消息
This commit is contained in:
parent
3fe6ab0e79
commit
10041b1a30
@ -582,9 +582,14 @@ class WebSocketDialogMsg extends AbstractModel
|
||||
// 其他网络图片
|
||||
preg_match_all("/<img[^>]*?src=([\"'])(.*?\.(png|jpg|jpeg|gif))\\1[^>]*?>/is", $text, $matchs);
|
||||
foreach ($matchs[2] as $key => $str) {
|
||||
$tmpPath = "uploads/chat/" . date("Ym") . "/" . $dialog_id . "/";
|
||||
Base::makeDir(public_path($tmpPath));
|
||||
$tmpPath .= md5s($str) . "." . $matchs[3][$key];
|
||||
if (str_starts_with($str, "{{RemoteURL}}")) {
|
||||
$tmpPath = Base::leftDelete($str, "{{RemoteURL}}");
|
||||
$tmpPath = Base::rightDelete($tmpPath, "_thumb.jpg");
|
||||
} else {
|
||||
$tmpPath = "uploads/chat/" . date("Ym") . "/" . $dialog_id . "/";
|
||||
Base::makeDir(public_path($tmpPath));
|
||||
$tmpPath .= md5s($str) . "." . $matchs[3][$key];
|
||||
}
|
||||
if (file_exists(public_path($tmpPath))) {
|
||||
$imagesize = getimagesize(public_path($tmpPath));
|
||||
if (Base::imgThumb(public_path($tmpPath), public_path($tmpPath) . "_thumb.jpg", 320, 0)) {
|
||||
|
||||
@ -896,6 +896,7 @@ export default {
|
||||
//
|
||||
if (this.replyActiveUpdate) {
|
||||
// 修改
|
||||
msgText = msgText.replace(new RegExp(`src=(["'])${$A.apiUrl('../')}`, "g"), "src=$1{{RemoteURL}}")
|
||||
const update_id = this.replyId
|
||||
this.$store.dispatch("setLoad", {
|
||||
key: `msg-${update_id}`,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user