Re: passing a url to a page

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

 



2007. 06. 15, péntek keltezéssel 15.28-kor ross@xxxxxxxxxxxxx ezt írta:
> Nothing happens no errors or anything I tried to debug using 
> include('display_image.php?img_url=$image_url') I got a parse error.

of course. include is totally different stuff, you can not give GET
parameters when including

what happens if you try to view display.image.php?img_url=something in
your browser? try it with a valid img_url value and an invalid one and
see if it throws any errors or anything

greets
Zoltán Németh

> 
> I would rather use buffers if this is possible?
> ----- Original Message ----- 
> From: "Zoltán Németh" <znemeth@xxxxxxxxxxxxxx>
> To: "Ross" <ross@xxxxxxxxxxxxx>
> Cc: <php-general@xxxxxxxxxxxxx>
> Sent: Friday, June 15, 2007 3:03 PM
> Subject: Re:  passing a url to a page
> 
> 
> 2007. 06. 15, péntek keltezéssel 14.45-kor Ross ezt írta:
> > I have a display_image.php page
> >
> > <?php
> >
> >
> >
> > $image = imagecreatefromjpeg($img_url);
> 
> where do you get $img_url from? GET request?
> then do something like
> 
> $img_url = $_GET['img_url'];
> if (!file_exists($img_url)) die "bad hacker";
> 
> before the above line. this will let you get rid of register_globals,
> and does a basic check of input, which is always very important
> 
> > if ($image === false) { exit; }
> >
> > // Get original width and height
> > echo $width = imagesx($image);
> > echo $height = imagesy($image);
> >
> > // New width and height
> > $new_width = 200;
> > $new_height = 150;
> >
> > // Resample
> > $image_resized = imagecreatetruecolor($new_width, $new_height);
> > imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width,
> > $new_height, $width, $height);
> >
> > // Display resized image
> > ;
> > header('Content-type: image/jpeg');
> > imagejpeg($image_resized);
> > exit();
> >
> > ?>
> >
> >
> > I want to output this as an image but cannot get it working. I need to 
> > pass
> > the image url something like this I thought would work
> >
> > echo "<img src=\"display_image.php?img_url=$image_url>";
> 
> this should work. what do you mean by not working? do you get any error
> message? anything? without information no one can tell you what's
> wrong...
> 
> greets
> Zoltán Németh
> 
> >
> >
> > any ideas?
> >
> 
> 
> 

-- 
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