public function runHandler()
    {
        $currentData = $this->_defaultData($this->_block->getContent());
        $uploadHandler = new GalleryUploadHandler([
            'print_response' => false,
            'selected_data' => $currentData,
            'script_url' => Request::url(),
            'max_file_size' => 2000000, //2MB   (will also error if over php.ini post_max_size)
            'accept_file_types' => '/\.(gif|jpe?g|png)$/i',
            'upload_dir' => public_path() . '/uploads/system/gallery/' . $this->_block->name . '/' . $this->_block->getPageId() . '/',
            'upload_url' => URL::to('/uploads/system/gallery/' . $this->_block->name . '/' . $this->_block->getPageId()) . '/'
        ]);
        if (!empty($uploadHandler->name)) {
            $order = 0;
            foreach ($currentData as $imageData) {
                if ($order < $imageData->order) {
                    $order = $imageData->order;
                }
            }
            AdminLog::new_log('Uploaded files to Gallery (ID ' . $this->_block->id . ')');
            $currentData[$uploadHandler->name] = new \stdClass;
            $currentData[$uploadHandler->name]->caption = '';
            $currentData[$uploadHandler->name]->order = $order + 1;
            $currentData[$uploadHandler->name]->path = '/' . $this->_block->getPageId() . '/';
            $this->_block->updateContent(serialize($currentData));
        }
        if ($this->_block->getPageId() && !config('coaster::admin.publishing')) { // update live page if no publishing
            PageVersion::latest_version($this->_block->getPageId(), true)->publish();
        }
        return $uploadHandler->get_response();
    }
public function runHandler()
    {
        $currentData = $this->_defaultData($this->_block->getContent());
        $uploadHandler = new GalleryUploadHandler([
            'print_response' => false,
            'selected_data' => $currentData,
            'script_url' => Request::url(),
            'max_file_size' => 2000000, //2MB   (will also error if over php.ini post_max_size)
            'accept_file_types' => '/\.(gif|jpe?g|png)$/i',
            'upload_dir' => public_path() . '/uploads/system/gallery/' . $this->_block->name . '/' . $this->_block->getPageId() . '/',
            'upload_url' => URL::to('/uploads/system/gallery/' . $this->_block->name . '/' . $this->_block->getPageId()) . '/'
        ]);
        if (!empty($uploadHandler->name)) {
            $order = 0;
            foreach ($currentData as $imageData) {
                if ($order < $imageData->order) {
                    $order = $imageData->order;
                }
            }
            AdminLog::new_log('Uploaded files to Gallery (ID ' . $this->_block->id . ')');
            $currentData[$uploadHandler->name] = new \stdClass;
            $currentData[$uploadHandler->name]->caption = '';
            $currentData[$uploadHandler->name]->order = $order + 1;
            $currentData[$uploadHandler->name]->path = '/' . $this->_block->getPageId() . '/';
            $this->_block->updateContent(serialize($currentData));
        }
        if ($this->_block->getPageId() && !config('coaster::admin.publishing')) { // update live page if no publishing
            PageVersion::latest_version($this->_block->getPageId(), true)->publish();
        }
        return $uploadHandler->get_response();
    }
public function runHandler ( ) { $ currentData = $ this -> _defaultData ( $ this -> _block -> getContent ( ) ) ; $ uploadHandler = new GalleryUploadHandler ( [ 'print_response' => false , 'selected_data' => $ currentData , 'script_url' => Request :: url ( ) , 'max_file_size' => 2000000 , //2MB   (will also error if over php.ini post_max_size) 'accept_file_types' => '/\.(gif|jpe?g|png)$/i' , 'upload_dir' => public_path ( ) . '/uploads/system/gallery/' . $ this -> _block -> name . '/' . $ this -> _block -> getPageId ( ) . '/' , 'upload_url' => URL :: to ( '/uploads/system/gallery/' . $ this -> _block -> name . '/' . $ this -> _block -> getPageId ( ) ) . '/' ] ) ; if ( ! empty ( $ uploadHandler -> name ) ) { $ order = 0 ; foreach ( $ currentData as $ imageData ) { if ( $ order < $ imageData -> order ) { $ order = $ imageData -> order ; } } AdminLog :: new_log ( 'Uploaded files to Gallery (ID ' . $ this -> _block -> id . ')' ) ; $ currentData [ $ uploadHandler -> name ] = new \ stdClass ; $ currentData [ $ uploadHandler -> name ] -> caption = '' ; $ currentData [ $ uploadHandler -> name ] -> order = $ order + 1 ; $ currentData [ $ uploadHandler -> name ] -> path = '/' . $ this -> _block -> getPageId ( ) . '/' ; $ this -> _block -> updateContent ( serialize ( $ currentData ) ) ; } if ( $ this -> _block -> getPageId ( ) && ! config ( 'coaster::admin.publishing' ) ) { // update live page if no publishing PageVersion :: latest_version ( $ this -> _block -> getPageId ( ) , true ) -> publish ( ) ; } return $ uploadHandler -> get_response ( ) ; }
Return upload images, handler also uploads image if in request
@return string
Return upload images handler also uploads image if in request