protected function resolveFilePath($path)
    {
        //Returns, if it's a remote file
        if (is_url($path)) {
            return $path;
        }

        //If it a relative path, it can be a file from a plugin or a file
        //  relative to `APP/webroot/img/`
        if (!Folder::isAbsolute($path)) {
            $pluginSplit = pluginSplit($path);

            //Note that using `pluginSplit()` is not sufficient, because
            //  `$path` may still contain a dot
            $path = WWW_ROOT . 'img' . DS . $path;
            if (!empty($pluginSplit[0]) && in_array($pluginSplit[0], CorePlugin::loaded())) {
                $path = CorePlugin::path($pluginSplit[0]) . 'webroot' . DS . 'img' . DS . $pluginSplit[1];
            }
        }

        is_readable_or_fail($path);

        return $path;
    }