Re: Function or GD problem?
| From: | Nate | Date: | Sun, 16 Mar 2003 23:59:19 +0000 |
| Subject: | Re: Function or GD problem? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139885@lists.php.net to get a copy of this message | ||
Hi, thanks for your help but im not sure what you mean. My image php page is
http://www.maxamplify.com/maxgallery/admin/test.php?src=img.jpg
This
contains the exact same code I posted below.
However if i make that into a function it gives me a red X as you can see
here: http://www.maxamplify.com/maxgallery/admin/test1.php?src=img.jpg
Just to clarify, im doing a function like
--------------------------
function ResizeJPG($src) {
global $full_img_url;
//code below
}
ResizeJPG($src);
--------------------------
Thanks for your help!
Nate
"Hugh Danaher" <hdanaher@earthlink.net> wrote in message
news:000d01c2ec15$1da339e0$0100a8c0@win95...
> In the receiving page, change your link from an <img src= > tag to an <a
> href= > then see what the error message says.
> Hugh
> ----- Original Message -----
> From: "Nate" <nate@greedyfools.com>
> To: <php-general@lists.php.net>
> Sent: Sunday, March 16, 2003 2:55 PM
> Subject: [PHP] Function or GD problem?
>
>
> > Function or GD problem...
> > I have a strange problem here, hoping someone can help.
> >
> > The following code works great but when I make it into a function it
> doesn't
> > error but it gives a RED X image.
> >
> > PHP:
> > <?php
> >
> > include("functions.inc.php");
> >
> > $size = getimagesize("uploads/$src");
> >
> > if ($size[2]==2) {
> >
> > $sourceimg = imagecreatefromjpeg("$full_img_url/$src") OR
DIE("DIED");
> >
> >
> > if($size[0]<$size[1]) {
> >
> > if($size[1]<$height) { $height1=$size[1]; } else {
> $height1=$height; }
> >
> > $width1=($size[0]*$height1)/$size[1];
> >
> > } else {
> >
> > if($size[0]<$width) { $width1=$size[0]; } else { $width1=$width; }
> >
> > $height1=($size[1]*$width1)/$size[0];
> >
> > }
> >
> > Header("Content-type: image/jpeg");
> >
> > $destimg = imagecreatetruecolor($width1,$height1) OR DIE("DIED");
> >
> > //Try to resample (needs GD 2)
> > if(imagecopyresampled($destimg, $sourceimg, 0,0,0,0, $width1,
$height1,
> > $size[0], $size[1])) {
> >
> > } elseif(imagecopyresized($destimg, $sourceimg, 0,0,0,0, $width1,
> > $height1, $size[0], $size[1])) {
> >
> > } else {
> > //HTML RESIZE
> > }
> >
> > imagejpeg($destimg,'',76) OR DIE("DIED");
> > imagedestroy($destimg) OR DIE("DIED");
> >
> > }
> >
> > }
> >
> > ?>
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>