Ejemplo n.º 1
0
 public function getListValue($row)
 {
     $html = '<span class="glyphicon glyphicon-minus"></span>';
     $type = $this->getRequiredAttribute('storage_type');
     $model = '\\' . \Config::get('jarboe::images.models.' . $type);
     if ($type == 'gallery') {
         $entity = $model::with('images')->find($this->getValue($row));
     } else {
         $entity = $model::find($this->getValue($row));
     }
     if ($entity) {
         if ($entity->isImage() && $entity->getSource()) {
             $html = '<img style="height: 90px;" src="' . asset(cropp($entity->getSource())->fit(90)) . '">';
         } elseif ($entity->isGallery()) {
             if ($entity->images->count()) {
                 $html = '<img style="height: 90px;" src="' . asset(cropp($entity->images[0]->getSource())->fit(90)) . '">';
             } else {
                 $html = $entity->title . ' | ' . $entity->created_at;
             }
         } elseif ($entity->isTag()) {
             $html = $entity->title . ' | ' . $entity->created_at;
         }
     }
     return $html;
 }
Ejemplo n.º 2
0
 private function getRedactorImagesList()
 {
     $model = '\\' . Config::get('jarboe::images.models.image');
     $images = $model::orderBy('id', 'desc')->skip()->limit()->get();
     $wysiwygColumn = Config::get('jarboe::images.wysiwyg_image_type', 'source');
     $data = array();
     foreach ($images as $image) {
         $data[] = array('id' => $image->id, 'thumb' => asset(cropp($image->getSource())->fit(100, 75)), 'source' => asset($image->getSource()), 'title' => $image->title, 'info' => $image->getInfo());
     }
     return Response::json($data);
 }