Manipulating and trapping skyrmions by magnetic field gradients