I have a form that uploads user data and images to Database and folder on the server. I am resizing the images to be no bigger than 1200px in width. So the first part (This Works start) of the code is working just fine. But the second part where i try to make a second image that is 400px in width and be saved to another folder is not working. Why is this, anybody have an idea please?
Thank you.
//This Works start
$save_th = $uploadfolder_th . "/" . $upload_DstName[$i]; //This is the new file you saving
$save = $uploadfolder . "/" . $upload_DstName[$i]; //This is the new file you saving
$file = $uploadfolder . "/" . $upload_DstName[$i]; //This is the original file
list($width, $height) = getimagesize($file) ;
$modwidth = 1200;
$diff = $width / $modwidth;
$modheight = $height / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 80) ;
//This Works end
//--------------------------------------------------------------------------------------------------
//This is not Working start
$modwidth_th = 400;
$diff_th = $width / $modwidth_th;
$modheight_th = $height / $diff_th;
$tn_th = imagecreatetruecolor($modwidth_th, $modheight_th) ;
$image_th = imagecreatefromjpeg($file) ;
imagecopyresampled($tn_th, $image_th, 0, 0, 0, 0, $modwidth_th, $modheight_th, $width, $height) ;
imagejpeg($tn_th, $save_th, 80) ;
//This is not Working end