public function thumbnail($name)
    {
        $this->loadModel('Field.FieldInstances');
        $instance = $this->_getInstance($name);

        if (!$instance) {
            throw new NotFoundException(__d('field', 'Invalid field instance.'), 400);
        }

        if (empty($this->request->query['file'])) {
            throw new NotFoundException(__d('field', 'Invalid file name.'), 400);
        }

        if (empty($this->request->query['size'])) {
            throw new NotFoundException(__d('field', 'Invalid image size.'), 400);
        }

        $imagePath = normalizePath(WWW_ROOT . "/files/{$instance->settings['upload_folder']}/{$this->request->query['file']}");
        $tmb = ImageToolbox::thumbnail($imagePath, $this->request->query['size']);

        if ($tmb !== false) {
            $this->response->file($tmb);

            return $this->response;
        }

        throw new NotFoundException(__d('field', 'Thumbnail could not be found, check write permissions?'), 500);
    }