Ok Ive added a bit more, the following doesnt throw an error but it doesnt work either:
//vars
$filename = $_FILES['imagefile']['name'];
$path = "users/$folder/$username/";
$full = "users/$folder/$username/$filename";
// Get image dimensions
$imagesize = getimagesize($full);
if ($imagesize[0] > 350) {
$newwidth = 350; $newheight = ((350 / $imagesize[0]) * $imagesize[1]);
//find the file extension
$image_type = strstr($filename, '.');
//decide which imagecreate line to use
if ($image_type == '.jpg' || $image_type == '.jpeg') {
$source = imagecreatefromjpeg($full);
}
elseif ($image_type == '.gif') {
$source = imagecreatefromgif($full);
}
elseif ($image_type == '.png') {
$source = imagecreatefrompng($full);
}
elseif ($image_type != '.jpg' || $image_type != '.jpeg' || $image_type != '.gif' || $image_type != '.png') {
echo ("invalid file type");
exit; }
//I think Im ok up to here. After this Im really not sure what Im doing.
//name the new image
$file = $newfilename . $filename;
//where to save new image
$fullpath = $path . $file;
//find size of old image
list($width, $height) = getimagesize($full);
//create new image
$thumb = imagecreatetruecolor($newwidth, $newheight);
//resize old image
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
//save resized image || set quality
imagejpeg($thumb, $fullpath, 60);
//return filepath
return $fullpath;
}