Skip to content

Commit

Permalink
修复图片资源找不到
Browse files Browse the repository at this point in the history
  • Loading branch information
jianyan74 committed Nov 22, 2019
1 parent f7ada31 commit 826ce2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions addons/RfWechat/services/AttachmentNewsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getFirstListPage($year = '', $month = '', $keyword = '')
$listTmp['key'] = $model['attachment_id'];
$listTmp['title'] = $model['title'];
$listTmp['type'] = Attachment::TYPE_IMAGE;
$listTmp['imgUrl'] = Url::to(['addons/rf-wechat/analysis/image', 'attach' => $model['thumb_url']]);
$listTmp['imgUrl'] = Url::to(['analysis/image', 'attach' => $model['thumb_url']]);

$list[] = $listTmp;
unset($listTmp);
Expand Down Expand Up @@ -83,7 +83,7 @@ public function formattingList($attachment_id)
->all();

foreach ($list as &$item) {
$item['thumb_url'] = urldecode(Url::to(['addons/rf-wechat/analysis/image', 'attach' => $item['thumb_url']]));
$item['thumb_url'] = urldecode(Url::to(['analysis/image', 'attach' => $item['thumb_url']]));
preg_match_all('/<img[^>]*src\s*=\s*([\'"]?)([^\'" >]*)\1/isu', $item['content'], $match);

$match_arr = [];
Expand All @@ -92,7 +92,7 @@ public function formattingList($attachment_id)
}

foreach ($match_arr as $src) {
$url = Url::to(['addons/rf-wechat/analysis/image', 'attach' => $src]);
$url = Url::to(['analysis/image', 'attach' => $src]);
$url = urldecode($url);
$item['content'] = str_replace($src, $url, $item['content']);
}
Expand Down
4 changes: 2 additions & 2 deletions addons/RfWechat/services/AttachmentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function getListPage($media_type = '', $year = '', $month = '', $keyword
$listTmp['type'] = $model['media_type'];
$listTmp['imgUrl'] = '';
if ($media_type == Attachment::TYPE_IMAGE) {
$listTmp['imgUrl'] = Url::to(['addons/rf-wechat/analysis/image', 'attach' => $model['media_url']]);
$listTmp['imgUrl'] = Url::to(['analysis/image', 'attach' => $model['media_url']]);
}

$list[] = $listTmp;
Expand All @@ -160,7 +160,7 @@ public function editNews(Attachment $model, $list, $isNewRecord)
{
$wechatArticleList = [];
// 获取图片的链接地址
$localImageUrl = Url::to(['addons/rf-wechat/analysis/image']) . "?attach=";
$localImageUrl = Url::to(['analysis/image']) . "?attach=";
foreach ($list as $key => &$item) {
$item['content'] = StringHelper::replace($localImageUrl, '', trim($item['content']));
$item['thumb_url'] = StringHelper::replace($localImageUrl, '', trim($item['thumb_url']));
Expand Down

0 comments on commit 826ce2c

Please sign in to comment.