When I load the page for the first time, the images are displayed correctly, but if I reload the same page, the previous loaded images don’t appears and I get 404 errors from each of them.
I have noticed that for the first load the .jobs files are created correctly in the media folder and the image is created and displayed correctly too. But, for the next load the images are not displayed even if they are already created in the media folder.
This only happens if the media folder is located in a different place than the /public folder.
You have to move the media folder inside your public folder and modify the path in your index.php. Like your assets, these files must be publicly available. Otherwise your thumbs are created alright (because that is done server side), but the files are not accessible by the user, hence you get a 404 error.
The main reason why I would not want the media into the public folder is due to reduce the need to recreate the thumbnails for each deploy we made on our site, and sometimes our site use Autoscaling features, so the same folder media must be present in different instances at the same time.
I’ll find a better solution to mount the media directory. But if some one here is using deployment with autoscaling, should be nice to know their solution.
Hm, the media folder isn’t really intended for deployment. It is in fact recommended that you empty the media folder when updating Kirby or plugins. So I’d be a bit careful with this.
Mmm… Our website handle hundred and hundred of images, and one page could loads a lot of them, so the performance is very poor when there is a lot of people accessing the website at the same time and the server is creating new thumbnails too.
That was another reason why we wanted to avoid the thumbnail re-creation.
@fenixkim I see the problem. Maybe the issue is not so much with the files when updating but with all the JS files from the Panel and plugins that are stored in the media folder as well.
So what’s the best way to make the media folder public in /public/index.php?
I tried just adding 'media' => $base . '/public/media',, but that didn’t work Weirdly it generates the folder in /public/media, however URLs are still 404. Folder seem to be empty as well.
Thank you! This worked locally, but on the server I’m getting 404s on the images URL. I moved content folder to the server, made sure to empty the media folder so that Kirby generates the media again. It does generate the correct structure, even the IDs match with the URLs on the public site, but no actual image files found in the folders, only .jobs.