Esempio n. 1
0
 function findImage($name, $def = '')
 {
     $c = $this->contents()->whereIn('item_id', $this->section()->first()->items()->where('name', '=', $name)->lists('id'))->get()->first();
     $item = $this->section()->first()->items()->where('name', '=', $name)->get()->first();
     if ($item->itemType()->first()->short_name === 'file-existing') {
         $i = File::find($c->value);
         if (!isset($i) || $i->value === '') {
             return $c->value;
         }
         return str_replace('\\', '/', $i->value);
     } else {
         return str_replace('\\', '/', $c->value);
     }
 }
Esempio n. 2
0
 function getImage()
 {
     //        if (DIRECTORY_SEPARATOR == '/') {
     //            return str_replace('\\','/',$this->value);
     //        } else if (DIRECTORY_SEPARATOR == '\\') {
     //            return str_replace('/','\\',$this->value);
     //        } else {
     //            return str_replace('\\','/',$this->value);
     //        }
     if (is_numeric($this->value)) {
         $f = File::find($this->value)->value;
     } else {
         $f = $this->value;
     }
     return $f === null ? '' : str_replace('\\', '/', $f);
 }