Lots of small fixes for PHP etc. Also added the dimensions field.