tags:

views:

43

answers:

3

If I have the path to an image stored in $thumbPath and I put that as the img tag's src it strips the end "/" from the tag. Does anyone have any ideas about this?

<img src="<?php echo $thumbPath; ?>" /> 
// <img src="path/to/file/foo.jpg"> 

Thanks

+2  A: 

It seems very unlikely that this is the location of the problem. "echo" is not semantically aware. It's much more likely that the error exists in whatever code is generating $thumbPath.

Gian
A: 

It will not strip it. As the / is outside the scope of the code you have provided us with. The source of the problem is something else, without any more info I can't help you.

Russell Dias
+1  A: 

Here's a test to show that Wrikken et al. are correct:

<?php
ob_start();
$thumbPath = 'path/to/file/foo.jpg';
?>

<img src="<?php echo $thumbPath; ?>" /> 

<?php
echo htmlspecialchars(ob_get_clean());

// Output:
// Browser: <img src="path/to/file/foo.jpg" />
// CLI: &lt;img src=&quot;path/to/file/foo.jpg&quot; /&gt;
GZipp