Re: Function or GD problem?
| From: | Hugh Danaher | Date: | Sun, 16 Mar 2003 23:38:14 +0000 |
| Subject: | Re: Function or GD problem? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139883@lists.php.net to get a copy of this message | ||
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
>