Is the temporary file necessary here?  Why not just file_put_contents the lorem ipsum directly into $photo->file_path() ?