sulu / SuluHeadlessBundle

Bundle that provides controllers and services for using Sulu as headless content management system
MIT License
44 stars 25 forks source link

Discuss: Sulu Media as Base64 Output. #15

Open TheCadien opened 4 years ago

TheCadien commented 4 years ago

An feature I would like to discuss, is the output of Media in the Sulu Headless Bundle.

We use an own Headless Bundle for Sulu to provide 2 Systems with Content and Media from Sulu and our CMS Server isnt Public. So we build an Service to get Media Content as Base64 string.

I think such an service or an optional way to use such an service ,make sence in these bundle too. What did you think about it ?

wachterjohannes commented 4 years ago

@TheCadien it would make sense to implement this - but the problem i see is when you use a remote storage (or locally really large files) to store your original files. This leads to an increased network traffic compared with downloading the image directly from the storage via the give URL of the media (independent from the storage a local url or a remote s3 one for example).

We also thought about an api to provide the Media data over an json api (without the content). The Response of this API would contain a full URL to download the content of the image directly.

I think this would be a good trade-off between a simple to use solution and prevent unnecessarily high network traffic.

// cc @nnatter @alexander-schranz

alexander-schranz commented 4 years ago

I think its a very heavy process for the api also when we implement this we need to provide the original file as base64 and image formats as base64.

We definitly can not add this to the response of the media selection or single media selection as this would always trigger this heavy process.

So it would be again an own endpoint but then I don't understand its advantage to the exist download and image formats endpoint as converting the file content to base64 can be done also on the client side if needed.