Re: [SMARTY] Show image
| From: | Mark Rogers | Date: | Fri, 14 Feb 2003 11:19:06 +0000 |
| Subject: | Re: [SMARTY] Show image | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7755@lists.php.net to get a copy of this message | ||
Paul Lockaby wrote:
> If you use a PHP script, you can set the header content type to
> something like image/gif and then include an image from off of the
> directory tree.
>
> <?
> header("Content-type: image/gif");
> include("/path/to/hidden/image.gif");
> ?>
>
> I've never tried that, but that's the general idea.
Don't use "include" for things like this - include tells PHP to parse the
file, and every so often you'll find a GIF file with the <? character
sequence in it somewhere and PHP won't like the syntax of what follows :-)
(Been there, done that - took a long time to track it down because most
images worked fine.)
The PHP function "readfile" does what you want (and is a direct replacement
in the above code).
Mark Rogers,
Quarella (More Solutions) Ltd
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003