Jump to content

echo img src showing </span>


petroz

Recommended Posts

Hi Guys,

 

I am trying to echo the path to a img from a db. When my $thumb var is called it shows up with a valid url. When I compose the img src tag and echo $thumb I am getting a really weird looking url. The url's are showing up like the below;

 

http://mysite.local/wp-content/uploads/%3C/span%3E2009/09/yuriandgrouper.jpg%3Cspan%20style=

 

<img src="<?php echo $thumb;?>" height="50" width="50" border="0"/>

 

any help would be greatly appreciated. Thanks!

Link to comment
https://forums.phpfreaks.com/topic/189613-echo-img-src-showing/
Share on other sites

What you are seeing is an encoded URL.

 

Use urldecode() to echo the URL in it's human readable form.

 

<?php

$url = 'http://mysite.local/wp-content/uploads/%3C/span%3E2009/09/yuriandgrouper.jpg%3Cspan%20style= ';

echo urldecode($url);

?>

 

 

Will display:

 

http://mysite.local/wp-content/uploads/2009/09/yuriandgrouper.jpg

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.