Take out these 2 lines, I realized they were from an older version that I copy pasted.
$newfile = "/tmp/$now.jpg";
file_put_contents($newfile, $now);
You're going to need write permissions in your folder
/var/www/html/images/
There's a few ways to do that, some easier than others...