1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-30 14:14:55 +08:00
2019-12-13 00:10:10 +08:00

31 lines
677 B
PHP

<?php
namespace App\Http\Home\Controllers;
use App\Models\ContentImage as ContentImageModel;
use App\Services\Storage as StorageService;
class PublicController extends Controller
{
/**
* @Get("/content/img/{id}", name="home.content.img")
*/
public function contentImageAction($id)
{
$contentImage = ContentImageModel::findFirstById($id);
if (!$contentImage) {
$this->response->setStatusCode(404);
return $this->response;
}
$storageService = new StorageService();
$location = $storageService->getCiImageUrl($contentImage->path);
$this->response->redirect($location);
}
}