I am trying to create a watermarked version of an uploaded image and store both of them to the storage folder using laravel 5.6 and Intervention.
//create the watermarked image
$watermarkedImage = Image::make($request->file('photo'));
$watermark = Image::make(Storage::get('watermark.png'));
$watermark->widen(floor(($watermarkedImage->width() / 4) * 3));
$watermarkedImage->insert($watermark, 'center');
//save the watermarked and standard image to disc and recording their names for db
$location = $request->file('photo')->store('public/uploads');
$fileName = md5($location . microtime());
$extension = '.' . explode("/", $watermarkedImage->mime())[1];
$watermarkedLocation = Storage::putFileAs('public/watermarked/', $watermarkedImage, $fileName . $extension);
Whenever I try to run this code I get the error:
Command (GetRealPath) is not available for driver (Gd)
I've also tried using the ->save() and ->store() command on the watermardImage variable but they came up with the error:
Can't write image data to path (public/watermarked/6b2492b7856c4d68ea15509c5b908a8c.png)
and
Command (Store) is not available for driver (Gd)
Any help will be appreciated
Edit: Forgot to add that it successfuly saves the original image without the watermark