Is there a way to hide the main file? #2183
Replies: 1 comment 1 reply
-
You could use a file namer to name your conversions in a way that the name of the original can't be guessed: https://spatie.be/docs/laravel-medialibrary/v9/advanced-usage/naming-generated-files Another strategy you could use would be to storage the original files in a collection called "originals". You could add a watermark to the original file and then add that file also to a collection named "watermarked" or something similar. The |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
By default, files are uploaded to the "storage/app/public/media" location. Each photo has its own directory (1,2, etc.) and the image conversion files are located in the conversions subdirectory. However...
I need to make sure that the main uploaded file that the media library works with is not available to website users. In other words, I want to make sure that all the conversions I generate include a watermark, but I don't want to include a watermark in the original file. And of course, I don't want a user who can detect the name of the main file to be able to download the file (without a watermark).
It seems to me to be a very important feature, so I'm surprised that I don't see anyone on the Internet solving this problem.
If the main file is manually moved to another location, subsequent operations - such as file regeneration - https://spatie.be/docs/laravel-medialibrary/v7/converting-images/regenerating-images will not work.
How to achieve? Or did I omit some part of the documentation and is it possible to set the media library to store the main file in the specified location / directory (outside the public folder)?
Beta Was this translation helpful? Give feedback.
All reactions