user3384514
user3384514

Reputation: 297

{{HTML::image}} set width and height in Laravel

Sorry for the stupid question, but I looked everywhere in the doc. If I want to set size, height and width of an image with HTML::image, how can I do it? I tried with:

{{ HTML::image('path', array('width' => 70 , 'height' => 70)); }}

But it doesn't seem to work.

Upvotes: 8

Views: 36415

Answers (6)

Mikke Baldonado
Mikke Baldonado

Reputation: 39

<img src="{{ asset('folder-name/pic_trulli.jpg')}}" class="img-fluid" style="min-width: 20px; min-height: 20px;">

Upvotes: 0

Govind Samrow
Govind Samrow

Reputation: 10179

In Laravel 5 following ways to use img in blade:

{!! HTML::image('img/picture.jpg', 'a picture', array('class' => 'thumb')) !!}

Note: you need to install laravel library before use HTM i.e "laravelcollective/html": "~5.0",

OR

<img src="{!!asset('img/picture.jpg')!!}">

OR

Set dynamically url:

<img src="{!!asset('img/').'/'.$imgsrc!!}">

Upvotes: 2

Abhishek Shukla
Abhishek Shukla

Reputation: 1

<img src='./images/bajja_huggy2.gif' class= img-responsive style= height: 22px; width: 100px; >

Upvotes: -1

Hashmat Waziri
Hashmat Waziri

Reputation: 477

Solution : store image path to your MYSQL table field. And dont forget the dot ( . ) at the beginning of filepath.

<img src='./images/bajja_huggy2.gif' class= img-responsive style= height: 22px; width: 100px; >

you can see how I have used twitter bootstrap and other properties.

@foreach($imagefiles as $img)
<div class="col-xs-2 ">
  {{ $img->image_3}}
</div> 
@endforeach

Upvotes: 1

Ironheartbj18
Ironheartbj18

Reputation: 85

you can

{{ HTML::image($product->image, $product->title, array('width' => '90%', 'height' => '50%')) }}

it required to be Apostrophe if create inside the percent.

Upvotes: 0

darthmaim
darthmaim

Reputation: 5148

It should work with

{{ HTML::image('path', 'alt', array( 'width' => 70, 'height' => 70 )) }}

The alt text comes before the attributes array.

Upvotes: 26

Related Questions