My Kirby /content folder is 2.3 gb in size, but for a while did not paid attention to /media folder which as it appears raised to 10 gb size over the time.
So question is - is there way to prevent that file generation if file once is generated?
Need to admit that using Kirby as db for React frontend. In Kirby wrote my own API php file which generates JSON with all links. As noticed, files to media folder are copied when accessing/requesting file (image) via url in application.
Yes, Kirby copies all files to the media folder. You can prevent that if you create a custom file::url component that load the files from the content folder.
Everything is working flawlessly with standard images… but problem is with thumbs urls, was trying something similar, but seems that thumbs are generated and saved in /media folder anyways…
Currently it means that I need manually open all 1000 pages - so thumb would be generated and stored in folder…
Well, the thumbs have to be stored somewhere. They are not duplicated from the content folder to the media folder, but only created in the media folder?
Another strange thing - its working in local development mode (PHP 8.0.14), but not working on server (PHP 7.4.28). For example - if I clicking on image in panel (so it would open large in new tab) - I get “Not found”. But path is fully correct… and image physically is located there…
Plugin code is from previously mentioned example / documentation:
Kirby version 3.6.2 … seems that Kirby is not serving content folder or its some .htaccess rule in kirby folder?.. because if I serve content folder with different service, then images in content folder is accessible in my web application.
It’s the following rule in the .htaccess file delivered with the Starter/PlainKits:
# block all files in the content folder from being accessed directly
RewriteRule ^content/(.*) index.php [L]
Since the .htaccess file is only relevant for Apache web servers, you would have to implement corresponding rules in other server environment (Nginx etc.)
While this working for original files, as discussed previously - for thumbnails (which are generated and stored in media folder) its not working. Problem is that Im generating API json with all thumbnail links, but physically they are not generated in media folder - only when first time accessing/ referring them, then they are generated and available. If I have 1000 pages, I need to open each page so thumbnail would be generated …
Any suggestions how to create some script which would put those thumbnails in media folder?
Main idea - to create standalone content/media folder which I can use without php.
Which pointed me to necessary direction - $image->publish() does the job for copying images to /media folder, BUT somehow it does not work if I generate thumbnails… currently don’t understand what Im missing.