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?
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();
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);
My image file path is public/img/stuvi-logo.png and
my app.blade.php file path is resources/views/app.blade.php
Inside of my app.blade.php file I use {{HTML::image('/img/stuvi-logo.png')}}
to display an image.
I don't understand why this won't find the image.
What is the root folder of the image() method?
If you use bootstrap, you might use this -
<img src="{{URL::asset('/image/propic.png')}}" alt="profile Pic" height="200" width="200">
note: inside public folder create a new folder named image then put your images there. Using URL::asset() you can directly access to the public folder.
Change /img/stuvi-logo.png to img/stuvi-logo.png
{{ HTML::image('img/stuvi-logo.png', 'alt text', array('class' => 'css-class')) }}
Which produces the following HTML.
<img src="http://your.url/img/stuvi-logo.png" class="css-class" alt="alt text">
Update After Laravel 5 this package has been deprecated and maintained as a separate external package. in order to work need to add this composer require laravelcollective/html. more details https://laravelcollective.com/
as of now, you can use
<img src="{{ asset('images/foo.png') }}" alt="tag">
In Laravel 5.x you can use laravelcollective/html and the syntax:
{!! Html::image('img/logo.png') !!}
It will look for an image inside of a public/storage folder where you can define your own image folder
<img src="{{ Storage::url($post->image->path) }}" alt="">
Always try to dump what you are looking for first and than pass it to a url method.
Also, you can create your own url() method inside your Image model if you have some
public function url()
{
return Storage::url($this->path);
}
Then in your blade template you can use this method as follows:
<img src="{{ $post->image->url() }}" alt="">
Had the same problem with laravel 5.3...
This is how I did it and very easy.
for example logo in the blade page view
****<image img src="/img/logo.png" alt="Logo"></image>****
In Laravel 5.x, you can also do like this .
<img class="img-responsive" src="{{URL::to('/')}}/img/stuvi-logo.png" alt=""/>
you can Using asset() you can directly access to the image folder.
<img src="{{asset('img/stuvi-logo.png')}}" alt="logo" class="img-size-50 mr-3 img-circle">
in my case this worked perfectly
<img style="border-radius: 50%;height: 50px;width: 80px;" src="<?php echo asset("storage/TeacherImages/{$studydata->teacher->profilePic}")?>">
this code is used to display image from folder
Assuming the file you want to display is public try adding the variable in your Mail builder function.
public function toMail($notifiable)
{
$img_url = env('APP_URL')."/img/stuvi-logo.png";
return (new MailMessage)
->subject('Test')
->markdown('vendor.mail.markdown.message', [
'data' => $this->data,
'img_url'=>$img_url
]);
}
And then use your 'img_url' variable set in the array in your email blade file.
< img src={{img_url}} alt="Logo" height="50"/>
This worked for me on Laravel 8.xx.
I have this foreach loop pulling images from my db :
`#foreach (var item in model)
<tr>
<td>
<img width="50" height="50" src="#Url.Action("GetImage", "Product", new { item.ProductId})"/>
</td>
...`
I tried to wrap it in an 'a' tag but all I get is 404's.
<img width="".../>
Any ideas?
an image with a hyperlink is what I'm trying to achieve. You click the
image and you're taken to the edit page.
Okay so suppose you get the image as shown in your question Product.GetImage and then the edit page is called by Product.Edit, you can have this:
<img src="#Url.Action("GetImage","Product")" />