พอดีผม ก็อบ code จากบทเรียน ตามนี้
$images = $file;
$height = 400;
$size = getimagesize($images);
$width = round($height*$size[0]/$size[1]);
if($size[2] == 1)
{
$images_orig = imagecreatefromgif($images);
} else if($size[2] == 2) {
$images_orig = imagecreatefromjpeg($images);
}
$photoX = imagesx($images_orig);
$photoY = imagesy($images_orig);
$images_fin = imagecreatetruecolor($width, $height);
imagecopyresampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
imagejpeg($images_fin, $images);
imagedestroy($images_orig);
imagedestroy($images_fin);
แล้วเกิด error แบบนี้
Warning: Division by zero in C:\AppServ\www\newsiam\contact_us\contact.php on line 89
Warning: imagesx(): supplied argument is not a valid Image resource in C:\AppServ\www\xxxxx\contact_us\contact.php on line 104
Warning: imagesy(): supplied argument is not a valid Image resource in C:\AppServ\www\xxxxx\\contact_us\contact.php on line 105
Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in C:\AppServ\www\xxxxx\contact_us\contact.php on line 106
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in C:\AppServ\www\xxxxx\contact_us\contact.php on line 107
Warning: imagejpeg(): supplied argument is not a valid Image resource in C:\AppServ\www\xxxxx\contact_us\contact.php on line 108
Warning: imagedestroy(): supplied argument is not a valid Image resource in C:\AppServ\www\xxxxx\contact_us\contact.php on line 109
Warning: imagedestroy(): supplied argument is not a valid Image resource in C:\AppServ\www\xxxxx\contact_us\contact.php on line 110
ต้องแก้อย่างไรเหรอครับ ขอบคุณครับ
Tag : - - - -