The media centre is the central place which gather most of the files used by the applications. It contains images, documents, videos or any other file.
When accessing a media for the first time, the 404 handle is invoked. It creates a symbolic link in the public/media directory, so subsequent requests don’t need to use the 404 handler anymore.
It works this way because we’ll be able to handle private medias in the future. The latter will return:
In the case of transformed images, the process is similar with a additional step: storing of the transformed image in the directory local/cache/media/.
When PHP sends a big file on the ouput, it blocks the process until the transfer is completely done. But it’s possible to release the process instantaneously by delegating the work to the underlying web server (usually Apache or nginx).
The XSendfile mechanisme can be used. It consists of sending a special header from the PHP script, its name can vary upon one server or another:
You may not want to store all your files in the media centre. For instance, a ‘human resources’ application collects CV of candidates, and you don’t want them to be visible in the media centre.
There’s an associated file mechanism to handle this case. It works roughly the same as email attachments and allows to store a CV with its candidates data.