Make sure $modx->resource is existing for logging

When pThumb is used in the mgr context for example, the $modx->resource object is not always set, what leads to a fatal error (using get() on a non-object) in that case. The added check prevents this...
Merge pull request #20 from exside/patch-1

Make sure $modx->resource is existing for logging