1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00

fix output type

This commit is contained in:
Damodar Lohani 2022-03-13 07:58:49 +00:00
parent 935430c3e3
commit 7d32f84cc2

View file

@ -950,9 +950,8 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
$cache = new Cache(new Filesystem(APP_STORAGE_CACHE . DIRECTORY_SEPARATOR . 'app-' . $project->getId() . DIRECTORY_SEPARATOR . $bucketId . DIRECTORY_SEPARATOR . $fileId)); // Limit file number or size
$data = $cache->load($key, 60 * 60 * 24 * 30 * 3/* 3 months */);
$output = (empty($output)) ? ( empty($type) ? 'jpg' : $type ) : $output;
if ($data) {
$output = (empty($output)) ? ( empty($type) ? 'jpg' : $type ) : $output;
return $response
->setContentType((\array_key_exists($output, $outputs)) ? $outputs[$output] : $outputs['jpg'])
->addHeader('Expires', $date)
@ -1002,8 +1001,6 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
$image->setRotation(($rotation + 360) % 360);
}
$output = (empty($output)) ? $type : $output;
$data = $image->output($output, $quality);
$cache->save($key, $data);