Category : image

I have FormRequest with rule ‘photo’ => ‘required|image’, If i upload jpeg image, this rule failed, because in src/Illuminate/Validation/Concerns/ValidatesAttributes.php in method validateImage sets extensions for check return $this->validateMimes($attribute, $value, [‘jpeg’, ‘png’, ‘gif’, ‘bmp’, ‘svg’, ‘webp’]); but for image/jpeg in validateMimes laravel set extensions as ‘jpg’ It’s because in /symfony/http-foundation/File/File.php method guessExtension return first extension by ..

Read more

now in home blade i need to adding image different like option select but not select this is change currency so need not same logo, so when i adding the code he give me same logo so i need to make it different by name in DB my code <td data-input="@lang(‘From’)"><div class="thumb"><img height="60px" src="{{asset(getImage(imagePath()[‘currency’][‘path’].’/’. $currency->currency_image, ..

Read more

This is my problem: my problem This storing function: function store(Request $request) { if($request->hasFile(‘medl_img_ved’)) { $file = $request->file(‘medl_img_ved’); $extention = $file->getClientOriginalExtension(); $filename = time().’.’.$extention; $file->move(‘uploads/mediaLibrary/’.$filename); $media_library->medl_img_ved = $filename; } $media_library->save(); } this is blade code: @foreach($imgs as $img) medl_img_ved) }}” class=”img-thumbnail” width=”75″ /> {{ $img->medl_name}} @endforeach where $images variable sent from controller gather the image ..

Read more

I try to resize and upload an image with Laravel8 Image Package by this blow code: public function addImage($input_image,$folder_name) { $img = Image::make($input_image->getRealPath()); $img->resize(200, 200, function ($constraint) { $constraint->aspectRatio(); })->save(‘thumbs/img-‘ . verta()->format(‘h-i-s’) .’.’. $input_image->getClientOriginalExtension()); $image_temp_uploadName = ‘img-‘ . verta()->format(‘h-i-s’) .’.’. $input_image->getClientOriginalExtension(); $input_image->move($folder_path, $image_temp_uploadName); DB::table(‘image_tb’)->insert([ ‘image_name’ => $folder_name.’/’.$image_temp_uploadName ]); } It works and everything is ok ..

Read more

I’m trying to add an user to data base in latavel. following is my User Model. <?php namespace AppModels; use IlluminateContractsAuthMustVerifyEmail; use IlluminateDatabaseEloquentFactoriesHasFactory; use IlluminateFoundationAuthUser as Authenticatable; use IlluminateNotificationsNotifiable; use SpatiePermissionTraitsHasRoles; class User extends Authenticatable implements MustVerifyEmail { use HasFactory, Notifiable, HasRoles; /** * The attributes that are mass assignable. * * @var array */ ..

Read more

{"message":"The given data was invalid.","errors":{"category_image":["The category image must be an image.","The category image must be a file of type: jpeg, png, jpg, gif, svg.","The category image may not be greater than 2048 characters."]}} this message shows every time even when I upload .jpg/.png/.jpeg file my validation code: $request->validate([ ‘category_name’ =>’required|min:3|max:20|unique:categories’, ‘publication_status’=>’required’, ‘category_image’ =>’required|image|mimes:jpeg,png,jpg,gif,svg|max:2048′, ]); my ..

Read more

I am trying to include Icons in laravel email templates without success. I would like to include .svg (or any other format) icons in buttons, links … on the layout template. This is my current code in "resources/views/vendor/mail/html/layout.blade.php" file: <!– Body content –> <tr> <td class="content-cell"> {{ IlluminateMailMarkdown::parse($slot) }} <!– First try. No success –> ..

Read more

[This image of composer update command not working][1] [Following error occur while running the program][2] web.php <?php use IlluminateSupportFacadesRoute; use InterventionImageImageManagerStatic as Image; Route::get(‘/’, [AppHttpControllersHomeController::class, ‘index’])->name(‘home’); Route::get(‘/image’, function(){ $img = ImageManagerStatic::make(‘images/altroz13.jpg’) ->resize(400, 250) ->save(‘images/altroz13a.jpg’); }); [1]: https://i.stack.imgur.com/tc6Ad.png [2]: https://i.stack.imgur.com/oO7Bp.png Sourc..

Read more

i’m trying to display some stored images from the storage folder but it doesn’t show! here is the controller: public function store(Request $request) { $templates = new templates([ "image_path"=>$request->image->hashName(), "image_path2"=>$request->image2->hashName(), "image_path3"=>$request->image3->hashName(), ]); $request->image->store(‘uploads’); $request->image2->store(‘uploads’); $request->image3->store(‘uploads’); $templates->save(); here’s the src images: <td> <img src= "storage/app/public/uploads/{{$templates->image_path}}"></img></td> <td><img src= "storage/app/public/uploads/{{$templates->image_path2}}"></img></td> <td><img src="storage/app/public/uploads/{{$templates->image_path3}}"></img></td> Sourc..

Read more

I have problem to validate my image. Its ok on another project but in new project Laravel 8 always fail. View: <label class="btn btn-primary" for="img" style="margin-top: 25px">upload image</label> <input type="file" id="img" name="avatar" accept="image/*" hidden/> Controller: $validated = $request->validate([ ‘avatar’ => ‘image|mimes:jpeg,png,jpg,gif,svg|max:2048’, ]); Error: The avatar must be an image. The avatar must be a file ..

Read more