Re: dynamic <img>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel Brown wrote:
    Hello, Anugrah.

On 9/18/07, Anugrah Widya <anuwidy@xxxxxxxxx> wrote:
i have problem with dynamic image displaying

here the snippets

thumb.php
<?php
header("Content-type: image/jpg");
$file = "data/original/filename.jpg";
readfile($file);
?>

img.php
<img src="thumb.php?filename.jpg" />

    From your above examples, two questions come to mind:
        1.) Is thumb.php in a folder above `data`?  If not, adjust
your path accordingly.
        2.) When using the query ?filename.jpg are you going to call
that as an $argv[1] variable?  If you want to use it as a $_GET,
$_POST, or $_REQUEST, it will need a variable name with an assigned
value.  For example:
            <img src="thumb.php?img=filename.jpg">
L>thumb.php
<?
    $path = "../data/original/"; // In case it's a same-level
directory as the PWD
    $img = $_GET['img'];
    header("Content-type: image/jpg");
    readfile($path.$img);
?>

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Give a man a fish, he'll eat for a day.  Then you'll find out he was
allergic and is hospitalized.  See?  No good deed goes unpunished....

thank you Mr. Brown for your reply,

yep thumb.php and img.php are in the same level

correction for img.php
<img src="thumb.php?url=filename.jpg" />

i don't know what wrong with it, when i save the image data to another files, the image didn;t corrupted, but when displayed dynamically it's corrupted.., and the path are ok ;)

did i miss something on this, and i didn;t aware of it ?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux