PHP version: php5-fpm
PHP is not limited to creating just HTML output. It can also be used to create and manipulate image files in a variety of different image formats, including GIF, PNG, JPEG, WBMP, and XPM. Even more convenient, PHP can output image streams directly to a browser. You will need to compile PHP with the GD library of image functions for this to work. GD and PHP may also require other libraries, depending on which image formats you want to work with.
If you’re installing any sort of web application or website that plays with images, particularly photographs, this is usually essential.
Installing it is straight forward. I installed this through my SSH tunnel, using Putty. If you’re inside your Ubuntu machine, you’ll be able to use the command window.
sudo apt-get install php5-gd sudo service nginx restart
That should get you going pretty smartly.
Hope this helps!
For more details (and where the quote came from at the top) head to the PHP Documentation on the GD Library.