public function generate($reference)
    {
        $adapter = $this->getAdapter();
        if ($adapter instanceof AwsS3) {
            return $adapter->getUrl($reference);
        } elseif ($adapter instanceof Local) {
            $request = $this->getRequest();

            return $request->getSchemeAndHttpHost().'/'.$this->getLocalUploadDirectory().'/'.$reference;
        }

        return $reference;
    }