If you are going to output the image, then you cannot output anything except the image, so maybe:
// Creates an image resource
$image = imagecreatefromjpeg($tmp_img);
// Tells the browser what type of file
// Outputs the file to the browser
imagejpeg($image, '', 90);
// Frees the memory used for the file
You also need to make sure nothing else is output before the image output, such as a BOM at the start of your script if it's saved as UTF-8, or anything else that is not part of the image data.