if($picture_change == "yes" && $main_picture != ""){
if ($main_picture_type == "image/pjpeg"){
$dest_file = "../../images_dynamic/".$section."_".$id.".jpg";
$imagehw = getimagesize($main_picture);
$src_w = $imagehw[0];
$src_h = $imagehw[1];
$dest_w = 165;
if($dest_w != $src_w){
$float = ($dest_w*$src_h)/$src_w;
$dest_h = round($float);
}else{
$dest_h = $src_h;
}
$quality = 90;
$src_img = imagecreatefromjpeg($main_picture);
$dest_img = imagecreatetruecolor($dest_w, $dest_h);
imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $dest_w, $dest_h, $src_w, $src_h);
if(imagejpeg($dest_img, $dest_file, $quality)){
echo "image created<br>";
}
imagedestroy($src_img);
imagedestroy($dest_img);
}else{
echo "File is not an image";
}
}
When I run this code on one server under our host everything goes through without a hitch.
On the second server i get an error:
Fatal error: Call to undefined function: imagecreatefromjpeg() in /hsphere/local/home/sjohnson/testdomain/admin/content/product_mod.php on line 34
(edit) Can anyone please tell me if my code is wrong or do I need to contact our server admin to fix this?