Re: dynamic <img>
| From: | Anugrah Widya | Date: | Tue, 18 Sep 2007 15:33:09 +0000 |
| Subject: | Re: dynamic <img> | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-262202@lists.php.net to get a copy of this message | ||
Daniel Brown wrote:
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 ?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 aboveyour path accordingly.data? If not, adjust2.) When using the query ?filename.jpg are you going to callthat 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-leveldirectory 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....