@markwillis82 this is not necessarily going to be the core path since the core can be moved in advanced installs. Could you change it to something like `MODX_CORE_PATH."cache/gallery-tmp/"`?
_Note: Could also we worth looking into `$modx->cacheManager`_