Using ML 6.0
I'm integrating DigitalOcean Spaces (which is S3 compatible) and am trying to figure out how to do a temporary URL.
My media on DO is set to private, but I would like to issue a temporary URL to authenticated users. How would I do this? I couldn't find anything when searching "temporary" in the docs.
Edit: It might be a nice feature to have a way to determine if a file is public or private when defining media conversions... :)
There's nothing implemented for temporary URLs now. Laravel has a nice method for it:
https://laravel.com/docs/5.5/filesystem#file-urls
I'd accept a PR that adds creating of temporary urls in a fully tested, easy to use way for urls to media and urls to converted media.
Wish I could help code it, but my PHP & Laravel skills are nowhere near what's required. :(
I can, however, offer ideas: I think it would be a good thing to not only give each image a temp URL, but each conversion as well.
I upload a photo and want to make three different sizes of it, small (for mobile), medium (for desktop and tablet), and large for Lightbox display. All three of those would be public URLs.
I upload a photo that I want to sell, so I don't want to show the large one. In this case I could have a small and medium for thumbnail display, and the large one with a private URL that is only visible when the user purchases access.
Basically the same as #2, but with 6 conversions instead of 3. The 3 public conversions will be watermarked, or blurred, or obfuscated in some way, and the 3 private conversions will be normal photos that will only be shown if the user is granted access.
Hopefully that makes sense. :)
@codyphobe I tried that too but kept receiving the error: This driver does not support creating temporary URLs.
I couldn't get it to work.
Thanks for this!
Unfortunately, it doesn't seem to work with DigitalOcean, which I'm assuming has something to do with this: https://github.com/GrahamCampbell/Laravel-Flysystem/issues/100#issuecomment-330216084
This is an FYI, not a complaint. :)
@timgavin So you implemented spaces instead s3 with this package. I have a question, how can I set my spaces url correctly? I set this in medialibrary.php:
'domain' => 'https://sfo2.digitaloceanspaces.com'
but I am getting this error:
Error executing "PutObject" on "https://la-space.s3.sfo2.amazonaws.com/6/backgroundish.jpg"; AWS HTTP error: cURL error 6: Could not resolve host: la-space.s3.sfo2.amazonaws.com
How did you set your space url so? thanks!
I didn't. I gave up and went with S3.
damn, I can't find a solution. thanks anyway tim!
@timgavin So you implemented spaces instead s3 with this package. I have a question, how can I set my spaces url correctly? I set this in medialibrary.php:
'domain' => 'https://sfo2.digitaloceanspaces.com'but I am getting this error:
Error executing "PutObject" on "https://la-space.s3.sfo2.amazonaws.com/6/backgroundish.jpg"; AWS HTTP error: cURL error 6: Could not resolve host: la-space.s3.sfo2.amazonaws.com
How did you set your space url so? thanks!
Same problem
I will look into the code and check if I could solve this. You can also use File Storage (https://laravel.com/docs/5.7/filesystem) and specify that your files should be stored in your space.