if (!empty($this->featuredImage)) {
$imageHashName = $this->featuredImage->hashName();
// Append to the validation if image is not empty
$validateData = array_merge($validateData, [
'featuredImage' => 'image'
]);
// This is to save the filename of the image in the database
$data = array_merge($data, [
'featured_image' => $imageHashName
]);
// Upload the main image
$this->featuredImage->store('public/photos');
Storage::makeDirectory('public/photos_thumb');
// Create a thumbnail of the image using Intervention Image Library
$manager = new ImageManager();
$image = $manager->make('storage/photos/' . $imageHashName)->resize(300, 200);
$image->save('storage/photos_thumb/' . $imageHashName);
Last active
November 4, 2021 07:26
-
-
Save spham/d7a9bdbc956969dabcbe23217f7b4f49 to your computer and use it in GitHub Desktop.
YUNC LARAVEL 7 WITH LIVEWIRE
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment