If you get following error:

Call to undefined function imagecreatefromgif()

You just need to install right version of GD. After 2.0.28 gif support was reverted back.

To fix this error:

sudo apt-get install php5-gd

If you are using nginx with php5-fpm do:

sudo /etc/init.d/php5-fpm restart