图片管理列表,psd、tiff 格式的图片预览时使用缩略图 #339

This commit is contained in:
Wisp X 2022-03-22 08:13:12 +08:00
parent 43b54a05ca
commit ede1ec5344
2 changed files with 3 additions and 2 deletions

View File

@ -67,7 +67,7 @@ class ImageController extends Controller
}
})->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']);

View File

@ -353,9 +353,10 @@
$('.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 : '-')