Use interventions save method instead? http://image.intervention.io/api/save
or you could try
Storage::put($path, (string) $file->encode());
I'm coding a file upload for images in which I want to manipulate the image before uploading. However, when I combine Intervention Image's stream() with Laravel's built in Storage::put(), I keep facing the same error with: "file_put_contents(PATH): failed to open stream: Permission denied".
My code is like:
$path = 'public/SOMENAME';
$file = Image::make($image)
->orientate()
->resize(800, null, function ($constraint)
{
$constraint->aspectRatio();
$constraint->upsize();
});
Storage::put($path, $file);
I have tried to change permission on both storage/, storage/SOMETHING and xampp's tmp-folder to 777 for all users and groups, but nothing seems to work. If I only use Storage::put() directly on the file, I face no issues. What could be wrong?
I use Windows 10 64bit and run the server with npm run watch.
Thank you in advance.
if you want put it to public disk, so you can access it by url
just simple do this
Storage::disk('public')->putFile('photos', new File($file));
Please or to participate in this conversation.