Тёмный

#47. Product CRUD - Add Product 

Sawa Stacks
Подписаться 10 тыс.
Просмотров 1,2 тыс.
50% 1

Опубликовано:

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 17   
@hassaneldika6645
@hassaneldika6645 2 месяца назад
@sawastacks I'm trying to create news seller product but it is not create maybe the error from the path of the image please can you advise?
@mndev610
@mndev610 6 месяцев назад
hi thanks for this playlist is this last video or will it continue?
@sawastacks
@sawastacks 6 месяцев назад
No. it is not last video. Tommorow or tuesday, two next videos will be published.
@azrilmlk
@azrilmlk 5 месяцев назад
hello sir, when will this series continue ?
@sawastacks
@sawastacks 5 месяцев назад
Today👍
@pascotech7802
@pascotech7802 5 месяцев назад
Hello Sir, I have a suggestion, 1. I really don't trust sellers to have the patience to make images square and maximum of 1024MB, can we use a small library that helps compress images to a certain size and also crop a square of the product? just like the image cropper but rigid square size. 2. is it possible for admin to convert a regular customer to a seller with just one click? or the customer who chooses to become a seller will just have to create a new seller account?
@sawastacks
@sawastacks 5 месяцев назад
Hello friend. You' re right. If you don't trust a user (sellers) while they are creating a product and trying to upload an image which is not square and that image may has large size. You can use the following trick to prevent that image to excess 1024MB by using Image intervention package for Laravel. use Intervention\Image\Facades\Image; //new ..................... $product_image = null; //Upload product image if($request->hasFile('product_image')){ $path = "images/products/"; $file = $request->file('product_image'); $filename = 'PIMG_'.time().uniqid().'.'.$file->getClientOriginalExtension(); $maxWidth = 1080; //new $maxHeight = 1080; //new $full_path = $path.$filename; //new $image = Image::make($file->path()); //new // $upload = $file->move(public_path($path),$filename); // replaced by below lines $image->height() > $image->width() ? $maxWidth = null : $maxHeight = null; //new $image->resize($maxWidth, $maxHeight, function ($constraint) { //new $constraint->aspectRatio(); $constraint->upsize(); }); $upload = $image->save($full_path); //new if( $upload ){ $product_image = $filename; } } Thats it!! In order to prevent a large size of an image, just, try to make small values on maxWidth and maxHeight. For converting custom account to seller account with one click, we will see that in next videos. Thank you. Happy coding.....
@pascotech7802
@pascotech7802 5 месяцев назад
@@sawastacks God Bless you, and thanks for the swift response.
@francknguemete6823
@francknguemete6823 5 месяцев назад
@@sawastacks which class provide the Image::make() please?
@sawastacks
@sawastacks 5 месяцев назад
After including "use Intervention/Image/Facades/Image;" of Image intervention package.
@pascotech7802
@pascotech7802 6 месяцев назад
i'm stuck, console keeps giving me 500 internal server error then Uncaught TypeError: Cannot read properties of undefined (reading 'errors') at Object.error (add:682:54)
@pascotech7802
@pascotech7802 5 месяцев назад
Error Fixed: the ajax couldn't catch the error, i didn't edit my Product model sluggable parameters after copying from categories model.
@SrkSasuke
@SrkSasuke 5 месяцев назад
why my database picture_image = "C:\xampp\tmp\php4C40.tmp"
@pascotech7802
@pascotech7802 5 месяцев назад
wait, why use "picture_image" instead of product_image?
@francknguemete6823
@francknguemete6823 5 месяцев назад
Because your save $product->product_image = $request->product_image; intead of saving directly $product->product_image = $product_image;. You have already write in the top $product_image = $filename;
@pascotech7802
@pascotech7802 6 месяцев назад
Hello sir, i sent some observations to your email.
Далее
#48. Product CRUD - Listing Products
12:37
Просмотров 532
The TRIPLE FOLDING phone has a Problem.
12:54
Просмотров 1,9 млн
Microsoft Makes Windows Worse With AI
9:34
Просмотров 165 тыс.
OxygenOS 15 Launch Event | Speed Meets AI
17:46
Просмотров 334 тыс.
2024 Earbuds Awards - Unexpected Winners!
16:35
Просмотров 25 тыс.
AI Agents Can Do Your Work in SECONDS… But How?
8:11
So I've tried 3 popular Laravel CMSs...
17:53
Просмотров 9 тыс.