hello i have a script error when uploading photos, I tried in local work but when trying on the web is not successful, the error message is Fatal error: Call to undefined function imagecreatetruecolor () . is there a solution?
case 'maintenanceAC':
$dtDir_01="uploadfoto/$date_y/";
$dtDir_02="uploadfoto/$date_y/$date_m/";
$dtDir_03="uploadfoto/$date_y/$date_m/$site_id/";
$dtDir_04="uploadfoto/$date_y/$date_m/$site_id/AC/";
$link=$dtDir_04;
if(!is_dir($dtDir_01)){ mkdir($dtDir_01); mkdir($dtDir_02); mkdir($dtDir_03);mkdir($dtDir_04); }
else if(!is_dir($dtDir_02)){mkdir($dtDir_02);mkdir($dtDir_03);mkdir($dtDir_04);}
else if(!is_dir($dtDir_03)){mkdir($dtDir_03);mkdir($dtDir_04);}
else if(!is_dir($dtDir_04)){mkdir($dtDir_04);}
$id_foto=$_POST['id_foto'];
foreach($id_foto as $key => $value){
$fileName=$_FILES['foto']['name'][$key];
if(!empty($fileName)){
$namaBaru=$site_id.'_'.$tgl.'_'.$value.'_'.$tno;
$source = $_FILES['foto']['tmp_name'][$key];
$target = $link.$fileName;
move_uploaded_file($source, $target);
$imagepath = $fileName ;
$save = $link.$namaBaru.'.jpg'; //This is the new file you saving
$file = $link.$fileName; //This is the original file
list($width, $height) = getimagesize($file) ;
$tn = imagecreatetruecolor($width, $height) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $width, $height, $width, $height) ;
imagejpeg($tn, $save,25) ;