[bob@elitegroup.on.ca: image resize error still happening]
| From: | The Doctor | Date: | Mon, 09 Dec 2002 14:50:01 +0000 |
| Subject: | [bob@elitegroup.on.ca: image resize error still happening] | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-127497@lists.php.net to get a copy of this message | ||
Why is the below occuring??
I am using the most current libraries available.
----- Forwarded message from Bob Federer <bob@elitegroup.on.ca> -----
Resent-Message-Id: <200212091447.gB9ElmK6011164@doctor.nl2k.ab.ca>
Reply-To: <bob@elitegroup.on.ca>
From: "Bob Federer" <bob@elitegroup.on.ca>
To: "Dave Y" <root@nk.ca>
Subject: image resize error still happening
Date: Sun, 8 Dec 2002 11:42:29 -0500
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Resent-From: root@doctor.nl2k.ab.ca
Resent-Date: Mon, 9 Dec 2002 07:47:47 -0700
Resent-To: The Doctor <doctor@doctor.nl2k.ab.ca>
Hi Dave,
Im still getting the following error when trying to run any of the scripts
for resizing jpgs:
Fatal error: Call to undefined function: imagecreatefromjpeg() in
/usr/home/swp/html/php/thumbtest.php on line 20
The source for thumbtest.php is as follows if it helps (the file is in the
php folder in swp):
<?
function checkgd(){
$gd2="";
ob_start();
phpinfo(8);
$phpinfo=ob_get_contents();
ob_end_clean();
$phpinfo=strip_tags($phpinfo);
$phpinfo=stristr($phpinfo,"gd version");
$phpinfo=stristr($phpinfo,"version");
$end=strpos($phpinfo," ");
$phpinfo=substr($phpinfo,0,$end);
$phpinfo=substr($phpinfo,7);
if (preg_match("/2./",$phpinfo)){$gd2="yes";}
return $gd2;
}
function createthumb($name,$filename,$new_w,$new_h){
global $gd2;
$system=explode(".",$name);
if
(preg_match("/jpg|jpeg/",$system[1])){$src_img=imagecreatefromjpeg($name);}
if
(preg_match("/png/",$system[1])){$src_img=imagecreatefrompng($name);}
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
if ($old_x > $old_y) {
$thumb_w=$new_w;
$thumb_h=$old_y*($new_h/$old_x);
}
if ($old_x < $old_y) {
$thumb_w=$old_x*($new_w/$old_y);
$thumb_h=$new_h;
}
if ($old_x == $old_y) {
$thumb_w=$new_w;
$thumb_h=$new_h;
}
if ($gd2==""){
$dst_img=ImageCreate($thumb_w,$thumb_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
}else{
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y
);
}
if (preg_match("/png/",$system[1])){
imagepng($dst_img,$filename);
} else {
imagejpeg($dst_img,$filename);
}
imagedestroy($dst_img);
imagedestroy($src_img);
}
$gd2=checkgd();
print ( $gd2 );
$p="pic1.jpg";
createthumb("pics/".$p,"thumbs/tn_".$p,100,100);
?>
----- End forwarded message -----
--
Member - Liberal International On 11 Sept 2001 the WORLD was violated.
This is doctor@nl2k.ab.ca Ici doctor@nl2k.ab.ca
Society MUST be saved! Extremists must dissolve.
Merry Christmas 2002 and Happy 2003