You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've noticed that the resource return for media assets always contain the media asset itself as a base64 encoded string. This seems to slow down the return by a huge amount and since the URL to the hosted version of the file is also returned, it's unnecessary for a lot of use-cases. Could this be taken out, moved into a parameterized version of the same response or even moved into its own route entirely?
public function getAssetsAction(string $mediaId, string $extension): SingleResourceResponseInterface {
$fileProvider = $this->fileProvider;
$file = $fileProvider->getFile(ArticleMedia::handleMediaId($mediaId), $extension);
if (null === $file) {
throw new NotFoundHttpException('Media don\'t exist in storage');
}
$mediaManager = $this->mediaManager;
return new SingleResourceResponse([
'media_id' => $mediaId,
'URL' => $mediaManager->getMediaPublicUrl($file),
// 'media' => base64_encode($mediaManager->getFile($file)), <----- THIS LINE IS HEAVY
'mime_type' => Mime::getMimeFromExtension($file->getFileExtension()),
'filemeta' => [],
]);
}
The text was updated successfully, but these errors were encountered:
Hi!
We've noticed that the resource return for media assets always contain the media asset itself as a base64 encoded string. This seems to slow down the return by a huge amount and since the URL to the hosted version of the file is also returned, it's unnecessary for a lot of use-cases. Could this be taken out, moved into a parameterized version of the same response or even moved into its own route entirely?
The text was updated successfully, but these errors were encountered: