function processImages($image, &$imagePath, &$bigImagePath) { $result = null; if ($_FILES[$image]["error"] == UPLOAD_ERR_OK) { $tmp_name = $_FILES[$image]["tmp_name"]; $name = $_FILES[$image]["name"]; $target_file = dirname(__DIR__) . "/images/" . $name; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); if (file_exists($target_file)) { $bigImagePath = str_replace($_SERVER['DOCUMENT_ROOT'], "", $target_file); $imagePath = ImageResizer::i()->resizeImage($target_file, 200, 200); if ($imagePath == null) { $result = "Resizing failed"; } } else { if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") { $result = "Invalid File Type. Only JPG, PNG and GIF are allowed"; } else { if (move_uploaded_file($tmp_name, $target_file)) { $bigImagePath = str_replace($_SERVER['DOCUMENT_ROOT'], "", $target_file); $imagePath = ImageResizer::i()->resizeImage($target_file, 200, 200); if ($imagePath == null) { $result = "Resizing failed"; } } else { $result = "Moving failed"; } } } } else { $result = "Upload failed"; } return $result; }