Fix a DOS vulnerability in graph.php

The issue happened when a user attempted to request a huge image, thus consuming all memory on the host.

I got burned by this one once, and fixed this (all be it a long time ago), Just pushing it here to help prevent others from suffering from this.