Gradient estimates via linear and nonlinear potentials