Skip to content

Commit

Permalink
图片管理列表,psd、tiff 格式的图片预览时使用缩略图 #339
Browse files Browse the repository at this point in the history
  • Loading branch information
0xxb committed Mar 22, 2022
1 parent b1b5bd0 commit 6f64031
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/ImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function index(Request $request): View
}
})->latest()->paginate(40);
$images->getCollection()->each(function (Image $image) {
$image->append('url', 'pathname');
$image->append('url', 'pathname', 'thumb_url');
$image->album?->setVisible(['name']);
$image->group?->setVisible(['name']);
$image->strategy?->setVisible(['name']);
Expand Down
3 changes: 2 additions & 1 deletion resources/views/admin/image/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,10 @@ function del(id) {
$('.item').click(function () {
let image = $(this).data('json');
let previewUrl = ['psd', 'tif'].indexOf(image.extension) === -1 ? image.url : image.thumb_url;
let html = $('#image-tpl').html()
.replace(/__id__/g, image.id)
.replace(/__url__/g, image.url)
.replace(/__url__/g, previewUrl)
.replace(/__user_name__/g, image.user ? image.user.name+'('+image.user.email+')' : '游客')
.replace(/__user_email__/g, image.user ? image.user.email : '-')
.replace(/__album_name__/g, image.album ? image.album.name : '-')
Expand Down

0 comments on commit 6f64031

Please sign in to comment.