Bootstrap dynamic slider in Laravel image is not showing - laravel

I am trying to implement bootstrap carousel dynamically from input in Laravel. My slider is working properly but the image is not showing.
slider code
#foreach($sliders as $key => $slider)
<div class="carousel-item {{$key == 0 ? 'active' : '' }}">
<img src="{{url('images/slider-rms', $slider->image)}}" class="d-block w-100" alt="...">
</div>
#endforeach
The backend and slider is working fine. But I am not sure about the path.
The image folder is : public->images->slider-rms
Image saving code
$slider = new Slider();
if($request->hasFile('slider')) {
// image that inserted
$image = $request->file('slider');
$img = time(). '.'.$image->getClientOriginalExtension();
$image->move('images/slider-rms/',$img);
$slider->image = $image;
}
$slider->save();

Related

Laravel 9 Image not displayed

I am uploading images on laravel 9.it is uploading successfully.but when view the images couldn't shown up.i don't know why is this problem.
when upload the image and save it shown up the link on the database table link. look like this /storage/images/1671456399_car1.jpg
i check through console http://127.0.0.1:8000/ url displayed look like this
here where i view the images
<td>
<img src="{{ asset($item->photo) }}" width= '50' height='50' class="img img-responsive" />
</td>
Save the images code
$requestData = $request->all();
$filename = time()."_".$request->file('photo')->getClientOriginalName();
$path = $request->file('photo')->storeAs('images',$filename,'public');
$requestData["photo"] = '/storage/'.$path;
Teacher::create($requestData);
this is value of $item-photo
<img src="http://127.0.0.1:8000/" width="50" height="50" class="img img-responsive">
The problem is in image store path.
Replace the code of store image and you will get a image.
$requestData = $request->all();
$filename = time()."_".$request->file('photo')->getClientOriginalName();
$path = $request->file('photo')->move(public_path('/images'),$filename);
$requestData["photo"] = '/images/'.$filename;
Teacher::create($requestData);

Laravel qrcode return weird symbol when format to png

I'm trying to genereate qrcode using https://www.simplesoftware.io/#/docs/simple-qrcode in Laravel. It's already working if I'm using svg format, but when I'm using png. It will return this:
�PNG IHDR,,\ѩgAMA���a cHRMz&�����u0�`:�p��Q<bKGD���̿IDATx��]lT��wY;��1ަ�2MY��tM��!Bn!j����LJ"��%�<�����ơy�b0��*U��OYJ����F��H��٪�`;����ۗ�s���ܹ�����ptf����^f�|�BAI_�$I��H�:��Jn`cJ�洜���Ͷ�Pw_P��*,�,�,��`-�_��Yo����`�~]0�2{�X���5��{��A�l�*
I've installed imagick on my windows, I don't know why this is happening
This is my controller:
public function print_qr($id)
{
$location = LocationLibrary::find($id);
$qrcode = QrCode::format('png')->size(300)->generate($location->id);
return view('location-library.qr-code', compact('qrcode', 'location'));
}
And this is my view:
<div id="qr-content" style="padding: 20px">
<p class="text-center" style="font-weight: bold">QR Code For {{ $location->location_name }}</p>
{!! $qrcode !!}
</div>

Laravels - Cannot Show Image after Upload and Save in Storage

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 $deTailsB)
<div class="col-md-4">
<img src="{{ asset('Uploads/'.$deTailsB->images) }}" width="100%" height="100%" title="{{ $deTailsB->images }}"/>
</div>
<div class="col-md-6">
<H1>{{ ucfirst(trans($deTailsB->name)) }}</H1>
<p>{{ strtoupper($deTailsB->author) }}</p>
</div>
#endforeach
Here is the controller to show data
public function detailBook($id)
{
$booksdetail = DB::table('books')->where('id', $id)->get();
return view ('details', ['booksDTL'=>$booksdetail]);
}
and here is when i run the code
enter image description here
The upload file save into folder 'Uploads' the folder is in the out of public folder, I already run the php artisan storage:link. But the upload picture still shown in thumbnail. Do you have any suggestion to this?

category product photo are not add my frontpage

everything is ok but not show the category page.it is the code which i used that my project upload all image
if ($request->file('image')){
$file = $request->file('image');
$photo = time().$file->getClientOriginalName();
$destination =public_path() . '/uploads/category';
$file->move($destination, $photo);
$category->image= $photo;
}else{
$category->image= 'dummy_cat.png';
}
it is controller code
'featuredCategories'=>Category::Where('status',1)->where('isFeatured',1)->get(),
its my front page code
#foreach($featuredCategories as $category)
<div class="col-sm-2">
<a href="{{route('category.show',$category->slug)}}"
class="tt-promo-box tt-one-child hover-type-2">
<img src="{{asset('uploads/category'.$category->image)}}"**strong text**
data-src="{{asset('uploads/category'.$category->image)}}" alt="">
<div class="tt-description">
<div class="tt-description-wrapper">
<div class="tt-background"></div>
<div class="tt-title-small">{{strtoupper($category->name)}}</div>
</div>
</div>
</a>
</div>
#endforeach
it is my front page image
enter image description here
"look #male #female category add but not show the category upload photo" that is that main problem i face this ..
not show the just image my front page

Laravel 5.4 image url stored in variable not seen on blade file

I am working on Laravel 5.4 and i use below given code.
#if( $profileurl )
<div class="">
#php
$cropped_img = "http://res.cloudinary.com/demo/image/fetch/w_150,h_150,c_thumb,g_face,r_max,f_auto/" . $profileurl ;
#endphp
<img src="{{ $cropped_img }}" height="150" width="150">
</div>
#endif
But problem is that image is not seen properly. But its url is correct.
The image is look like this.
Generated url is http://res.cloudinary.com/demo/image/fetch/w_150,h_150,c_thumb,g_face,r_max,f_auto/http://dev1.jdsoftvera.com/voting-system/public/profile/image/9ccca1ccad318a91a0a1c057663548b6Penguins.jpg
But the url is ok.
When i simply use this below code then image is seen.
<img src="{{ $profileurl }}" height="150" width="150">
This code is worked for me.
$profileurl = "http://res.cloudinary.com/demo/image/fetch/w_150,h_150,c_thumb,g_face,r_max,f_auto/" . $profileurl ;
$img = base64_encode($profileurl);
$profileurl = base64_decode($img);

Resources