When I upload images to the database Laravel rotates them, so I found Laravel is rotating the image when uploaded, then after implementing it I get this error exif_read_data() expects parameter 1 to be a valid path, array given
. How can I fix this?
Controller
if($request->hasFile('files')){
$store_file = [];
// $files = $request->file('files');
$exif = exif_read_data($request->file('files'));
if(!empty($exif['Orientation'])) {
switch($exif['Orientation']) {
case 8:
$image = imagerotate($image,90,0);
break;
case 3:
$image = imagerotate($image,180,0);
break;
case 6:
$image = imagerotate($image,-90,0);
break;
}
}
foreach ($exif as $file) {
$images = $file->store('public/photos');
$store_file[] = [
'product_id' => $product->id,
'filename' => $images
];
}
ProductsPhoto::insert($store_file);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire