html_image issue
| From: | Mike Evans | Date: | Wed, 29 Sep 2004 00:17:45 +0000 |
| Subject: | html_image issue | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-11829@lists.php.net to get a copy of this message | ||
Hi,
I've successfully used html_image quite a bit in the past, but recently ran into this rather odd problem... I'm trying to pass an absolute path to an image in my local filesystem... say:
/home/htdocs/mike/chandler2/htdocs/data/tn_test.jpg
with:
{html_image file=" /home/htdocs/mike/chandler2/htdocs/data/tn_test.jpg"}
or:
{html_image file=$path_to_image}
Nothing's getting displayed, however. So, I dug into the actual function and found this:
if (substr($file,0,1) == '/') {
$_image_path = $basedir . $file;} else {
$_image_path = $file;} That doesn't really make sense to me, as if the first character is an '/' then we're talking about an absolute path, right? And that being the case, why would we prepend the $basedir onto it? Sure enough, it's actually looking for the image at: /home/htdocs/home/htdocs/mike/chandler2/htdocs/data/tn_test.jpg Is this a bug, or am I just missing something obvious? Thanks a bunch, Mike