I am working with Symfony as an API and a React frontend divided in two separate projects.
I store user uploaded images inside a medias/
folder at the root of the Symfony project because some images are confidential (this is a business app) so they can't be simply put inside the public/
folder.
The upload part is fine but I can't figure out how to display the file in the React app even though I get the full link from the API using VichUploader's $this->storage->resolveUri(...)
as stated in the API-Platform documentation.
I understand why it doesn't work, as it gives me something like www.domain.com/medias/images/123.png
while the medias/
folder sits outside of the public/
directory.
I have no idea how to display those files. Every single documentation (Symfony, Vich...), guides and forum posts I've found are about displaying those images inside Twig or a webpacked javascript that is inside the Symfony project, while my javascript is in another different project.
Can anybody give me some pointers as to where to look for a solution?
As a reference, this is my VichUploader's configuration file:
vich_uploader:
db_driver: orm
mappings:
machine_image:
uri_prefix: /medias/images/machine
upload_destination: '%kernel.project_dir%/medias/images/machine'
namer: Vich\UploaderBundle\Naming\OrignameNamer