Hi there I am using Laravel 5.6 and Image Intervention Package. I am making a photo website in laravel. The user can upload a picture, the picture is then stored in storage/app/original-photos/account/.$user_id./$filename as a original picture. Then Image intervention makes a thumbnail of that same picture and stores it in public/storage/original-photos/account/thumbs/.$user_id./$filename
I created a symlink and also when I store the picture I set the visibility of the original picture to private.
All of it is working. But say a user wanted to see his original picture but it must NOT be accessible by typing or copying the link to the photo in the browser.
So when I am logged in I can access the picture. If I log out I can't access the picture I says that I must login.
If I am a different user I cannot access the picture aka link of the other user.
So its working.
But I don't wan't to be accessible by the link even if I am logged in as the correct user.
Is there some other way?
I also don't wan't it to download just to view it.
Later I will add a download button but not for now.
This is the function I made.
public function original($id)
{
$photo = Photo::findOrFail($id);
$user = Auth::user()->id;
$filename = ('app/original-photos/account/'.$user.'/'.$photo->photo);
return response()->download(storage_path($filename), null, [], null);
}
Can somebody help me out with this one?
Any help is appreciated !
Thanx alot in advance.