readfile and images

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jørn Dahl-Stamnes

    readfile and images

    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($imag e_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>b lablabla</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?

    --
    Jørn Dahl-Stamnes

  • Jørn Dahl-Stamnes

    #2
    Re: readfile and images

    Jørn Dahl-Stamnes wrote:
    [color=blue]
    > 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($imag e_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>b lablabla</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?[/color]

    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

    Comment

    Working...