Category : image

I will update the data its contain image, then when I will send to update here’s the error Call to a member function getClientOriginalName() This is my Controller public function updateBook(Request $request, $id){ $book = DB::table(‘books’)->where(‘id’,$id); $old = $book->select(‘images’); $ChecK = 0; $file = var_dump($request->file(‘images’)->getClientOriginalName()); $filename = time().$file; $path = public_path(‘/Uploads’); if($request->hasFile(‘images’)){ $file = $request->file(‘images’); ..

Read more

I will show the upload image but it shown a thumbnail, here is my Controller Code Upload a image file $file = $request->file(‘images’)->getClientOriginalName(); $filename = time().$file; $path = base_path(‘/Uploads’); if($request->hasFile(‘images’)){ $file = $request->file(‘images’); $file->move($path, $filename); DB::table(‘books’)->insert($filename); return redirect(‘home’)->with(‘status’, ‘insert succesfully’); } else { dd(‘Request Hash No File!’); } Here is my view @foreach ($booksDTL as ..

Read more

VIEW FILE <div class="col-sm-4"> <label>Other Images</label> <div class="input-group control-group img_div form-group" > <input type="file" name="image[]" class="form-control"> <div class="input-group-btn"> <button class="btn btn-success btn-add-more" type="button">Add</button> </div> </div> </div> <div>@foreach($image as $image) <p><img src="{{asset(‘/files/’.$image->images)}}" height="50px" id="{{$image->id}}" class="photo"/> <button class="removeimg" data-id="{{$image->id}}" data-token="{{ csrf_token() }}">Remove</button></p> @endforeach </div> AJAX $(document).ready( function () { $(document).on(‘click’, ‘.removeimg’,function(){ var confirmation = confirm("are you sure ..

Read more

I have this in view. It is able to upload alright but it won’t show. Is there anything more I should add? <div class="col-md-4"> <img class="img img-fluid img-thumbnail" src="/storage/profile_images/{{$profile->profile_image}}"/> </div> here is my show.blade.php file <div class="col-md-4"> <img class="img img-fluid img-thumbnail" src="/storage/profile_images/{{$profile->profile_image}}"/></div> Here is the player.blade.php file: @if(count($players) > 0) <?php $index = 0; ?> ..

Read more

berita.blade.php https://i.stack.imgur.com/HVOx3.png img src=”{{ asset(‘/img/’. $berita->foto )}}” height=”50″ width=”50″ alt=”” srcset=”” BeritaController.php https://i.stack.imgur.com/z32Sc.png public function store(Request $request) { $af = $request->file(‘foto’)->store(‘public’); $ambilFoto = $af->getClientOriginalName(); $cek_berita = Berita::where(‘judul_berita’, $request->judul_berita)->count(); if ($cek_berita == 0) { $berita = new Berita; $berita->jenis_berita = $request->jenis_berita; $berita->judul_berita = $request->judul_berita; $berita->isi_berita = $request->isi_berita; $berita->foto = $ambilFoto; $af->move(public_path().’/img/’, $ambilFoto); $berita->save(); Alert::success(‘Berhasil Tambah Berita’, ..

Read more

Hi everyone I have this problem where I am not able to display the images that I have in the storage folder. I already connected the storage folder to the public one with the symlink (php artisan storage:link) but every time I try to visualize it I get this error from the console: "Failed to ..

Read more

I have two related models, and when deleting a blog, I need to delete the post, I use the onDelete (‘cascade’) method, it works as it should, but I also need to delete the images that are stored in the storage folder. $table->unsignedBigInteger(‘blog_id’); $table->foreign(‘blog_id’) ->references(‘id’)->on(‘blogs’)->onDelete(‘cascade’); I added the delete function to the blog controller, but ..

Read more

I have this function in my controller that create post and try to upload images and video : public function view_add_posts(Request $request) { $data=$request->all(); $rules=[ ‘video’ =>’mimes:mpeg,ogg,mp4,webm,3gp,mov,flv,avi,wmv,ts|max:50424405 |required’]; $validator = Validator($data,$rules); if($validator ){ $arr[‘categories’]=Category::all(); if ($request->ismethod(‘post’)){ $x=0; foreach($request->file(‘filenames’) as $file) { $x++; } $id= get_id(‘posts’); $post = new POST(); if($request->hasfile(‘video’)){ $post->video=’yes’; } $post->id=$id; $post->category_id=$request->category_id; $post->title_ku=$request->title_ku; ..

Read more

I have a function to add an image, and upon successful addition in the database, we have a path like public/images/asd.png. The question is how to make sure that when added to the name of the picture, an ID is added, and we have something like public/images/asd1.png, public/images/asd2.png, etc. function in Model public function getOriginImageUrl() ..

Read more

I am getting error while resizing image in laravel using Intervention Image Link of the Library: http://image.intervention.io/ $featured_image = $request->file(‘featured_image’); $tmpFilePath = public_path(‘upload/properties/’); //Path to the Folder $name = ‘property_’.time().’.’.$featured_image->extension(); $featured_image->move($tmpFilePath, $name); //Image resizing $image_original_path = $tmpFilePath.$name; $image_resize = Image::make($image_original_path); $image_resize->resize(383,251); $resize = public_path($tmpFilePath).’thumb_’.$name; $image_resize->save($resize); and getting below error InterventionImageExceptionNotWritableException Can’t write image data to ..

Read more