dynamic <img>
| From: | Daniel Brown | Date: | Tue, 18 Sep 2007 14:41:29 +0000 |
| Subject: | dynamic <img> | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-262199@lists.php.net to get a copy of this message | ||
Hello, Anugrah.
On 9/18/07, Anugrah Widya <anuwidy@gmail.com> 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....