Nieuw lid |
|
Hoi
Ik heb een image script maar ik krijg steeds de foutmelding:
Fatal error: Call to undefined function: imagecreatefromjpeg() in classes\profile.class.php on line 1912
/* inserting fossilpictures */
$img1 = $_FILES['img1']['name'];
$img2 = $_FILES['img2']['name'];
$img3 = $_FILES['img3']['name'];
if (!empty($img1))
{
$file_name = stripslashes($img1);
$file_name = str_replace("'","",$file_name);
$path = "fossilimgdb/$fossil_id/" . $file_name;
$copy = copy($_FILES['img1']['tmp_name'], $path);
// check if successfully copied
if ($copy)
{
$fossilpic = "fossilimgdb/$fossil_id/" . $file_name;
$width_height = getimagesize($fossilpic);
$width = $width_height[0];
$height = $width_height[1];
if ($width > $height)
{
$new_width = 100;
$ratio = $width / $height;
$new_height = $new_width / $ratio;
}
else
{
$new_height = 100;
$ratio = $height / $width;
$new_width = $new_height / $ratio;
}
$fileforthumb = ImageCreateFromJPEG($fossilpic) or die("couldn't open image");
$filethumb = ImageCreateTrueColor($new_width,$new_height) or die("couldn't create image");
ImageCopyResized($filethumb,$fileforthumb,0,0,0,0,$new_width,$new_height,imagesx($fileforthumb),imagesy($fileforthumb)) or die("couldn't resize image");
$fossilthumb = ImageJPEG($filethumb, "fossilimgdb/$fossil_id/thumbs/" . $file_name) or die("couldn't save image");
$fossilthumbnail = "fossilimgdb/$fossil_id/thumbs/" . $file_name;
}
}
if (!empty($img2))
{
$file_name = stripslashes($img2);
$file_name = str_replace("'","",$file_name);
$path = "fossilimgdb/$fossil_id/" . $file_name;
$copy = copy($_FILES['img2']['tmp_name'], $path);
// check if successfully copied
if ($copy)
{
$fossilpic2 = "fossilimgdb/$fossil_id/" . $file_name;
$width_height = getimagesize($fossilpic2);
$width = $width_height[0];
$height = $width_height[1];
if ($width > $height)
{
$new_width = 100;
$ratio = $width / $height;
$new_height = $new_width / $ratio;
}
else
{
$new_height = 100;
$ratio = $height / $width;
$new_width = $new_height / $ratio;
}
$fileforthumb = ImageCreateFromJPEG($fossilpic2) or die("couldn't open image");
$filethumb = ImageCreateTrueColor($new_width,$new_height) or die("couldn't create image");
ImageCopyResized($filethumb,$fileforthumb,0,0,0,0,$new_width,$new_height,imagesx($fileforthumb),imagesy($fileforthumb)) or die("couldn't resize image");
$fossilthumb2 = ImageJPEG($filethumb, "fossilimgdb/$fossil_id/thumbs/" . $file_name) or die("couldn't save image");
$fossilthumbnail2 = "fossilimgdb/$fossil_id/thumbs/" . $file_name;
}
}
if (!empty($img3))
{
$file_name = stripslashes($img3);
$file_name = str_replace("'","",$file_name);
$path = "fossilimgdb/$fossil_id/" . $file_name;
$copy = copy($_FILES['img3']['tmp_name'], $path);
// check if successfully copied
if ($copy)
{
$fossilpic3 = "fossilimgdb/$fossil_id/" . $file_name;
$width_height = getimagesize($fossilpic3);
$width = $width_height[0];
$height = $width_height[1];
if ($width > $height)
{
$new_width = 100;
$ratio = $width / $height;
$new_height = $new_width / $ratio;
}
else
{
$new_height = 100;
$ratio = $height / $width;
$new_width = $new_height / $ratio;
}
$fileforthumb = ImageCreateFromJPEG($fossilpic3) or die("couldn't open image");
$filethumb = ImageCreateTrueColor($new_width,$new_height) or die("couldn't create image");
ImageCopyResized($filethumb,$fileforthumb,0,0,0,0,$new_width,$new_height,imagesx($fileforthumb),imagesy($fileforthumb)) or die("couldn't resize image");
$fossilthumb3 = ImageJPEG($filethumb, "fossilimgdb/$fossil_id/thumbs/" . $file_name) or die("couldn't save image");
$fossilthumbnail3 = "fossilimgdb/$fossil_id/thumbs/" . $file_name;
}
}
if(isset($fossilpic)){
$query = "UPDATE images SET image1 = '".$fossilpic."' , thumb1 = '".$fossilthumbnail."' WHERE fossil_id = '".$fossil_id."'";
$result = mysql_query($query);
}
if(isset($fossilpic2)){
$query = "UPDATE images SET image2 = '".$fossilpic2."' , thumb2 = '".$fossilthumbnail2."' WHERE fossil_id = '".$fossil_id."'";
$result = mysql_query($query);
}
if(isset($fossilpic3)){
$query = "UPDATE images SET image3 = '".$fossilpic3."' , thumb3 = '".$fossilthumbnail3."' WHERE fossil_id = '".$fossil_id."'";
$result = mysql_query($query);
}
/* inserting fossilpictures */ $img1 = $_FILES['img1']['name']; $img2 = $_FILES['img2']['name']; $img3 = $_FILES['img3']['name']; { $path = "fossilimgdb/$fossil_id/" . $file_name; $copy = copy($_FILES['img1']['tmp_name'], $path); // check if successfully copied if ($copy) { $fossilpic = "fossilimgdb/$fossil_id/" . $file_name; $width = $width_height[0]; $height = $width_height[1]; if ($width > $height) { $new_width = 100; $ratio = $width / $height; $new_height = $new_width / $ratio; } else { $new_height = 100; $ratio = $height / $width; $new_width = $new_height / $ratio; } $fileforthumb = ImageCreateFromJPEG ($fossilpic) or die("couldn't open image"); $filethumb = ImageCreateTrueColor ($new_width,$new_height) or die("couldn't create image"); ImageCopyResized ($filethumb,$fileforthumb,0,0,0,0,$new_width,$new_height,imagesx ($fileforthumb),imagesy ($fileforthumb)) or die("couldn't resize image"); $fossilthumb = ImageJPEG ($filethumb, "fossilimgdb/$fossil_id/thumbs/" . $file_name) or die("couldn't save image"); $fossilthumbnail = "fossilimgdb/$fossil_id/thumbs/" . $file_name; } } { $path = "fossilimgdb/$fossil_id/" . $file_name; $copy = copy($_FILES['img2']['tmp_name'], $path); // check if successfully copied if ($copy) { $fossilpic2 = "fossilimgdb/$fossil_id/" . $file_name; $width = $width_height[0]; $height = $width_height[1]; if ($width > $height) { $new_width = 100; $ratio = $width / $height; $new_height = $new_width / $ratio; } else { $new_height = 100; $ratio = $height / $width; $new_width = $new_height / $ratio; } $fileforthumb = ImageCreateFromJPEG ($fossilpic2) or die("couldn't open image"); $filethumb = ImageCreateTrueColor ($new_width,$new_height) or die("couldn't create image"); ImageCopyResized ($filethumb,$fileforthumb,0,0,0,0,$new_width,$new_height,imagesx ($fileforthumb),imagesy ($fileforthumb)) or die("couldn't resize image"); $fossilthumb2 = ImageJPEG ($filethumb, "fossilimgdb/$fossil_id/thumbs/" . $file_name) or die("couldn't save image"); $fossilthumbnail2 = "fossilimgdb/$fossil_id/thumbs/" . $file_name; } } { $path = "fossilimgdb/$fossil_id/" . $file_name; $copy = copy($_FILES['img3']['tmp_name'], $path); // check if successfully copied if ($copy) { $fossilpic3 = "fossilimgdb/$fossil_id/" . $file_name; $width = $width_height[0]; $height = $width_height[1]; if ($width > $height) { $new_width = 100; $ratio = $width / $height; $new_height = $new_width / $ratio; } else { $new_height = 100; $ratio = $height / $width; $new_width = $new_height / $ratio; } $fileforthumb = ImageCreateFromJPEG ($fossilpic3) or die("couldn't open image"); $filethumb = ImageCreateTrueColor ($new_width,$new_height) or die("couldn't create image"); ImageCopyResized ($filethumb,$fileforthumb,0,0,0,0,$new_width,$new_height,imagesx ($fileforthumb),imagesy ($fileforthumb)) or die("couldn't resize image"); $fossilthumb3 = ImageJPEG ($filethumb, "fossilimgdb/$fossil_id/thumbs/" . $file_name) or die("couldn't save image"); $fossilthumbnail3 = "fossilimgdb/$fossil_id/thumbs/" . $file_name; } } $query = "UPDATE images SET image1 = '".$fossilpic."' , thumb1 = '".$fossilthumbnail."' WHERE fossil_id = '".$fossil_id."'"; } $query = "UPDATE images SET image2 = '".$fossilpic2."' , thumb2 = '".$fossilthumbnail2."' WHERE fossil_id = '".$fossil_id."'"; } $query = "UPDATE images SET image3 = '".$fossilpic3."' , thumb3 = '".$fossilthumbnail3."' WHERE fossil_id = '".$fossil_id."'"; }
Dit is het script..
Nu wil ik weten wat er fout gaat.. Kan iemand mij helpen?
|