if (file_exists($img)) { echo $img . "?r=" . rand(); } else { echo "profile/thumbnails/default.jpg"; } ?> > <br> Upload New Image <?php echo $img; if (isset($_POST['submit']) && $_FILES['uploaded_image']['tmp_name'] != "") { echo $img; $image = new SimpleImage(); $image->load($_FILES['uploaded_image']['tmp_name']); $image->resizethumbnail(); $image->save($img); } else { ?> <form action="image.php" method="post" enctype="multipart/form-data"> <input type="file" name="uploaded_image" /> <input type="submit" name="submit" value="Upload" /> </form> <?php } ?>