public function createImage($file, $userID, $jobID, $entryID) { if($file) { echo var_dump($file); if ((($file['type'] == 'image/jpeg') || ($file['type'] == 'image/png')) && ($file['size'] < 205000)) { $thbPath = '/data/htdocs/indieop.com/public_html/app/webroot/img/entries/'. $userID . '_' . $jobID . '_' . $entryID . '.' . pathinfo($file['name'], PATHINFO_EXTENSION); $fPath = '/data/htdocs/indieop.com/public_html/app/webroot/img/entries/'. $userID . '_' . $jobID . '_' . $entryID .'_max' . '.' . pathinfo($file['name'], PATHINFO_EXTENSION); $imgParams = getimagesize($file['tmp_name']); $width = $imgParams[0]; $height = $imgParams[1]; $twidth = 205; $theight = ($twidth / $width) * $height; $thumb = imagecreatetruecolor($twidth, $theight); $tmpImg; if($file['type'] == 'image/jpeg') { $tmpImg = imagecreatefromjpeg($file['tmp_name']); } else { $tmpImg = imagecreatefrompng($file['tmp_name']); } imagecopyresampled($thumb, $tmpImg, 0, 0, 0, 0, $twidth, $theight, $width, $height); if($file['type'] == 'image/jpeg') { $thumb = imagejpeg($thumb, $thbPath, 100); } else { $thumb = imagepng($thumb, $thbPath); } if (!$file["error"] > 0) { if(move_uploaded_file($file['tmp_name'], $fPath)) { return true; } else { return false; } } } else { return false; } } else { return false; } }