Way to verify if variable is a valid GD image resource?
The get_resource_type function should help you out. Short of writing code and seeing what it return, I'm not sure what it's going to say for a GD resource, so you're on your own there. Should be a good starting point, though!
get_resource_type() returns "gd" if the resource is a gd image, so that's what you need.