I can't upload images to my website. How can I fix? - laravel

When I get the picture from the url, I can put it on my site, but I cannot upload it from my pc.
Can you explain to me how Laravel uses src?
<div class="card bg-dark text-white">
<img src=" /img/manzara.jpg " class="card-img" alt="...">
<div class="card-img-overlay">
<h5 class="card-title">Card title</h5>
<p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<p class="card-text">Last updated 3 mins ago</p>
</div>

If the image is the public folder, change your tag as below:
<img src="{{asset('/img/manzara.jpg')}}" class="card-img" alt="...">

Related

Can't load variable image with spring boot thymeleaf

I'm very new to spring boot, and I have to do a proyect with Thymeleaf.
I can't figure out how to load the variable images from my folders.
<div class="row" th:fragment="searched-film">
<div class="card m-2" style="width: 12rem;" th:each="film : ${films}">
<img alt="Póster de la película" class="card-img-top p-3"
th:src="#{${'./static/images/peliculas/' + film.poster}}">
<div class="card-body">
<h5 class="card-title" th:text="${film.title}"></h5> <h6 class="card-title"
th:text="'(' + *{film.year} + ')'"></h6>
</div>
</div>
</div>
Title and the year works, but images dont load.
the files are in 'FilmoTokio\src\main\resources\static\images\peliculas', meanwhile this html in 'FilmoTokio\src\main\resources\templates'
This is the github: FilmoTokio
I tried to change the link, I used th:hrc, I changed the folder's name...

Can't seem to get Col-4 Working on Laravel

So I am trying to create a car sales website using Laravel. The code presented shows 20 Cars from the database being shown but all one after the other. I want it to appear in columns of 3 or 4 if possible. I've been trying to use col-4 but it doesn't make any difference. Any help appreciated. The only answer I could find online was that the container was within the row but I don't have this issue so unsure.
<div class="container text-center">
<h2>Cars</h2>
<div class="row">
#foreach ($allcars as $car)
<div class="col-4">
<div class="card">
<img class="card-img-top" src="{{asset('qashqai.jpg')}}" alt="Card
image cap">
<div class="card-body">
<h4 class="card-title">{{$car->name}}</h4>
<p class="card-text">{{$car->description}}</p>
</div>
<div class="card-body">
Card link
Another link
</div>
</div>
</div>
#endforeach
</div>
</div>

Spring : How to show image in thymeleaf from database

I'm doing project with Spring Boot+Spring Data+Spring MVC.I want to show image from database to thymeleaf but image not displayed. This is my code
<span th:each="room,iterStat : ${room}">
<div class="col-md-3 md-col">
<div class="col-md">
<a href="single.html" class="compare-in"><img th:src="#{/static/images/${room.image}}" alt="" />
</a>
<div class="top-content">
<h5><tr th:text="${room.name}"></h5>
<div class="white">
<a th:href="#{/room/{id}/book(id=${room.id})}" class="hvr-shutter-in-vertical hvr-shutter-in-vertical2">BOOK</a>
<p class="dollar"><span class="in-dollar">$</span><span>2</span><span>0</span></p>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
</span>
I save image with name image in database and i save image in folder ../static/images .. When I copy images name in database instead of ${room.image} , image will display..I don't know why
I've got the same issue, I get the issue resolved by doing this :--
<th:style="'background-image:url('+ ${room.image}+');'"></div>
Hope it helps.

Using xpath, I can't seem to be able to find a text node

So, I am building a web crawler for one site's comment section, and I have came with a problem, it seems I can't find a text node for the comments content. This is how the web pages element looks:
<div class="comments"> // this is the whole comments section
<div class="comment"> // this is where the p is located
<div class="comment-top">
<div class="comment-nr">208. PROTAS</div>
<div class="comment-info">
<div class="comment-time">2015-06-30 13:00</div>
<div class="comment-ip">IP: 178.250.32.165</div>
<div class="comment-vert1">
<a href="javascript:comr(24470645,'p')">
<img src="http://img.lrytas.lt/css2/img/com-good.jpg" alt="">
</a> <span id="cy_24470645"> </span>
</div>
<div class="comment-vert2">
<a href="javascript:comr(24470645,'m')">
<img src="http://img.lrytas.lt/css2/img/com-bad.jpg" alt="">
</a> <span id="cn_24470645"> </span>
</div>
</div>
</div>
<p class="text-13 no-intend">Test text</p> // I need to get this comments content
</div>
I tried a lot of xpath's like:
*/div[contains(#class, "comment")]/p/text()
/p[contains(#class, "text-13 no-intend")]/text()
etc.
But can't seem able to locate it.
Would appreciate any help.
How about this:
//div[#class = 'comments']/div[#class = 'comment'][1]/p/text()

Images won't scale with boot strap

I have images placed in my website using the < img> tag. When the website is scaled to a smaller screen the images hang over the container. Why are they not scaling with the the rest of the site? Any fixes?
<div class="container">
<div class="col-md-12">
<div class="col-md-4 padtop">
<img src="img/WDadd.png" alt="" />
</div>
</div>
</div>
I dont know if this is the right way to do it, but it seems to be working for me you could try to add, give it the class thumbnail on the image, and if you dont like the look of thumbnail you can always edit it in your css file
example: http://jsfiddle.net/abnH6/6/
<div class="container">
<div class="col-md-12">
<div class="col-md-4 padtop">
<img src="http://lorempixel.com/500/500/" alt="" class="thumbnail"/>
</div>
</div>
</div>

Resources