Reputation: 933
I want to use css in my blade.php files but I am having trouble doing so. I would like to avoid using an external css sheet. In a normal html file I can do something like this
<img src="/Users/rays/Desktop/Icons/Joe_Icon.png" style="width:160px;height:100px">
And it will generate an image for me that is resized.I am trying to do the same thing in a blade file but am having trouble.
The following code displays an image but doesn't it style it to the right dimensions, I also see the words style="width:160px;height:100px" on the screen.
<a href="#">{{ HTML::image("progress2/Icons/Joe_Icon.png")}} style="width:160px;height:100px" </a>
This also displays an image but doesn't display the image with the right size.
<style="width:160px;height:100px">
<a href="#">{{ HTML::image("progress2/Icons/Joe_Icon.png")}} </a>
</style>
And the following gets me a syntax error
<a href="#">{{ HTML::image("progress2/Icons/Joe_Icon.png" style="width:160px;height:100px" )}} </a>
Upvotes: 2
Views: 4575
Reputation: 163748
Try this one:
{!! HTML::image('progress2/Icons/Joe_Icon.png', 'alt', array( 'width' => 160, 'height' => 100 )) !!}
Also, hardcoding CSS is a bad practice. You should use CSS stylesheets and build images like this:
{!! HTML::image('progress2/Icons/Joe_Icon.png', 'alt', array('class' => 'progress_image')) !!}
Upvotes: 2