public function previewPath($preset = 'lightbox')
 {
     if (!$this->entity->isImage()) {
         return null;
     }
     // Glide stuff here...
     $urlBuilder = UrlBuilderFactory::create(url('/img'));
     return $urlBuilder->getUrl($this->entity->droplet->present()->directory() . '/' . $this->file_name, $this->buildParams($preset));
 }
Beispiel #2
0
 /**
  * @param $secret
  * @param ContainerInterface $container
  */
 public function __construct($secret, ContainerInterface $container)
 {
     $this->builder = BuilderFactory::create('', $secret);
     if ($container->has('twig.extension.assets')) {
         $this->webPath = reset(explode('?', $container->get('twig.extension.assets')->getAssetUrl('')));
     } else {
         $this->webPath = '';
     }
 }
 /**
  * Prepare driver before mount volume.
  * Return true if volume is ready.
  *
  * @return bool
  **/
 protected function init()
 {
     $this->fs = $this->options['filesystem'];
     if (!$this->fs instanceof FilesystemInterface) {
         return $this->setError('A filesystem instance is required');
     }
     $this->fs->addPlugin(new GetUrl());
     $this->options['icon'] = $this->options['icon'] ?: $this->getIcon();
     $this->root = $this->options['path'];
     if ($this->options['glideURL']) {
         $this->urlBuilder = UrlBuilderFactory::create($this->options['glideURL'], $this->options['glideKey']);
     }
     if ($this->options['imageManager']) {
         $this->imageManager = $this->options['imageManager'];
     } else {
         $this->imageManager = new ImageManager();
     }
     return true;
 }
Beispiel #4
0
 /**
  * Generate the url
  *
  * @return string
  */
 public function getURL()
 {
     $urlBuilder = UrlBuilderFactory::create($this->baseURL, $this->signKey);
     $encodedPath = implode('/', array_map('rawurlencode', explode('/', $this->sourceFile)));
     return $this->urlPrefix . $urlBuilder->getUrl($encodedPath, $this->modificationParameters);
 }
Beispiel #5
0
 /**
  * @return UrlBuilder
  */
 public function getUrlBuilder()
 {
     if (!$this->urlBuilder) {
         $this->urlBuilder = UrlBuilderFactory::create($this->baseUrl, $this->signKey);
     }
     return $this->urlBuilder;
 }
 /**
  * Generate the url
  *
  * @return string
  */
 public function getURL()
 {
     $urlBuilder = UrlBuilderFactory::create('img', $this->signKey);
     return $urlBuilder->getUrl($this->imagePath, $this->modificationParameters);
 }