Re: Function or GD problem?
| From: | Hugh Danaher | Date: | Mon, 17 Mar 2003 00:37:00 +0000 |
| Subject: | Re: Function or GD problem? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139889@lists.php.net to get a copy of this message | ||
Can't tell for sure, but you might have one more closing bracket than
needed. my suggestion to call it from an href rather than as an img tag was
based upon the fact that the href tag will show an error message whereas the
img tag won't.
Hugh
----- Original Message -----
From: "Nate" <nate@greedyfools.com>
To: <php-general@lists.php.net>
Sent: Sunday, March 16, 2003 3:59 PM
Subject: Re: [PHP] Function or GD problem?
> 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
> > >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>