You are here: Re: readfile and images « PHP Programming Language « IT news, forums, messages
Re: readfile and images

Posted by Jψrn Dahl-Stamnes on 01/24/06 19:35

JΓΈrn Dahl-Stamnes wrote:

> I'm trying to replace <IMG SRC="some image"> with the usage of readfile,
> but without luck. I have seen examples like this:
>
> header ('Content-length: ' .filesize($image_file));
> header ('Content-type: image/jpeg');
> readfile ($image_file);
>
> This works OK unless you have modified the header before. What I like to
> do is to display the image *within* HTML codes, something like:
>
> <HTML><HEADER>blablabla</HEADER><BODY>
> <?php
> echo "This is image $image_file:<BR>";
> readfile ($image_file);
> ?>
>
> But if I try to use the readfile as show above, I only get garbage... (as
> expected). So... how can I replace a <IMG..> statement with the use of
> readfile?

I got it... I have to use <IMG SRC=some-php-script.php?arg=filename> and
then use the code shown at the top.

--
JΓΈrn Dahl-Stamnes
http://www.dahl-stamnes.net/dahls/

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация