I want to upload image from base64
image in two version, one 250px
another 650px
with watermark and it give me back an error: Image source not readable
$path = public_path().'/seller/uploads/'. $seller->id .'/'. $adsid;
$watermark = public_path().'/watermark.png';
$Image = explode(";base64,", $img);
$ImageName = $date;
$ImageDecode = base64_decode($Image[1]);
$thumb_name = $ImageName.'-thumb.jpg';
$resize_name = $ImageName.'-resized.jpg';
Image::make($ImageDecode)->encode('jpg', 80)->orientate()->resize(250, null, function ($constraint) {
$constraint->aspectRatio();
})->save($path.'/'.$thumb_name);
Image::make($ImageDecode)->encode('jpg', 80)->orientate()->resize(650, null, function ($constraint) {
$constraint->aspectRatio();
})->insert($watermark, 'bottom-right', 10, 10)->save($path.'/'.$resize_name);
Error:
exception: "InterventionImageExceptionNotReadableException"
file:
"E:vendorinterventionimagesrcInterventionImageAbstractDecoder.php"
line: 351 message: "Image source not readable"
What I have missed?
xampp
PHP Version 8.1.12
Laravel Framework 8.83.23
2
Answers
Check the file folder names properly or not and also check the read permission for the folder you are trying to access through your code. Many time issue in such cases is the file/folder name