[UI] Use thumbnail path for thumbs
This commit is contained in:
@@ -26,8 +26,11 @@ use App\Core\DB\DB;
|
||||
use App\Core\GSFile;
|
||||
use App\Entity\AttachmentThumbnail;
|
||||
use App\Util\Common;
|
||||
use App\Util\Exception\NotFoundException;
|
||||
use App\Util\Exception\ServerException;
|
||||
use Symfony\Component\HttpFoundation\HeaderUtils;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class Attachment extends Controller
|
||||
{
|
||||
@@ -49,7 +52,18 @@ class Attachment extends Controller
|
||||
return GSFile::sendFile($res['file_path'], $res['mimetype'], $res['title'], HeaderUtils::DISPOSITION_ATTACHMENT);
|
||||
}
|
||||
|
||||
public function attachment_thumbnail(Request $request, int $id)
|
||||
/**
|
||||
* Controller to produce a thumbnail for a given attachment id
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id Attachment ID
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @throws ServerException
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function attachment_thumbnail(Request $request, int $id): Response
|
||||
{
|
||||
$attachment = DB::findOneBy('attachment', ['id' => $id]);
|
||||
if (!is_null($attachment->getScope())) {
|
||||
|
||||
@@ -44,6 +44,6 @@ abstract class Attachments
|
||||
$r->connect('attachment_view', '/attachment/{id<\d+>}/view', [C\Attachment::class, 'attachment_view']);
|
||||
$r->connect('attachment_download', '/attachment/{id<\d+>}/download', [C\Attachment::class, 'attachment_download']);
|
||||
$r->connect('attachment_thumbnail', '/attachment/{id<\d+>}/thumbnail', [C\Attachment::class, 'attachment_thumbnail']);
|
||||
$r->connect('thumbnail', '/thumbnail/{id<\d+>}', [C\Attachment::class, 'attachment_thumbnail']);
|
||||
$r->connect('thumbnail', '/thumbnail/{id<\d+>}', [C\Attachment::class, 'attachment_thumbnail']); // Backwards-compatibility
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user