unwanted '/' at the end of two concatenated strings used in tag

Stack Overflow Asked by dani on October 16, 2020

I have a simple laravel project.I want to concatenate two string.

$base_url ="https://image_base_url/";
$image_path = "/image_name.jpg";

then I use full_url inside img tag like so in laravel in index.blade.php file

<img src={{$full_url}} />;

the full_url is correct but when it place in src it will get an ‘/’ at
the end of it and image can not find that url

src will be like below
src ="http://baseurl/imagepath.jpg/"

but I want it like this


any of you my friends can help me out?thank you

2 Answers

do like this

<img src="{{$full_url}}" />;

Correct answer by 夜神夜神 on October 16, 2020

You have to write php variable in double quotes.

<img src="{{$full_url}}" alt="tag" />;

It's good practice to add alt="" attribute in img tag

Answered by Bhargav Variya on October 16, 2020

Add your own answers!

Related Questions

Detect if Class has an element inside of certain Class?

1  Asked on November 17, 2021 by ohval


Syntax error: missing ‘;’ before ‘*’ with Item class

1  Asked on November 17, 2021 by theandrewjeff


Run a query based on the values returned by another query

3  Asked on November 17, 2021 by kevin-d


simplfied observer pattern with std::shared_ptr/weak_ptr

1  Asked on November 17, 2021 by fatun


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP