public function setStamp(Request $request, $bas_id)
    {
        if (null === $file = $request->files->get('newStamp')) {
            $this->app->abort(400);
        }

        if ($file->getClientSize() > 1024 * 1024) {
            return $this->app->redirectPath('admin_display_collection', [
                'bas_id'  => $bas_id,
                'success' => 0,
                'error'   => 'file-too-big',
            ]);
        }

        if (!$file->isValid()) {
            return $this->app->redirectPath('admin_display_collection', [
                'bas_id'  => $bas_id,
                'success' => 0,
                'error'   => 'file-invalid',
            ]);
        }

        $collection = \collection::getByBaseId($this->app, $bas_id);

        try {
            $this->app->getApplicationBox()->write_collection_pic(
                $this->app['media-alchemyst'],
                $this->app['filesystem'],
                $collection,
                $file,
                \collection::PIC_STAMP
            );

            $this->app['filesystem']->remove($file->getPathname());
        } catch (\Exception $e) {
            return $this->app->redirectPath('admin_display_collection', [
                'bas_id'  => $bas_id,
                'success' => 0,
                'error'   => 'file-error',
            ]);
        }

        return $this->app->redirectPath('admin_display_collection', [
            'bas_id'  => $bas_id,
            'success' => 1,
        ]);
    }
public function setStamp(Request $request, $bas_id)
    {
        if (null === $file = $request->files->get('newStamp')) {
            $this->app->abort(400);
        }

        if ($file->getClientSize() > 1024 * 1024) {
            return $this->app->redirectPath('admin_display_collection', [
                'bas_id'  => $bas_id,
                'success' => 0,
                'error'   => 'file-too-big',
            ]);
        }

        if (!$file->isValid()) {
            return $this->app->redirectPath('admin_display_collection', [
                'bas_id'  => $bas_id,
                'success' => 0,
                'error'   => 'file-invalid',
            ]);
        }

        $collection = \collection::getByBaseId($this->app, $bas_id);

        try {
            $this->app->getApplicationBox()->write_collection_pic(
                $this->app['media-alchemyst'],
                $this->app['filesystem'],
                $collection,
                $file,
                \collection::PIC_STAMP
            );

            $this->app['filesystem']->remove($file->getPathname());
        } catch (\Exception $e) {
            return $this->app->redirectPath('admin_display_collection', [
                'bas_id'  => $bas_id,
                'success' => 0,
                'error'   => 'file-error',
            ]);
        }

        return $this->app->redirectPath('admin_display_collection', [
            'bas_id'  => $bas_id,
            'success' => 1,
        ]);
    }
public function setStamp ( Request $ request , $ bas_id ) { if ( null === $ file = $ request -> files -> get ( 'newStamp' ) ) { $ this -> app -> abort ( 400 ) ; } if ( $ file -> getClientSize ( ) > 1024 * 1024 ) { return $ this -> app -> redirectPath ( 'admin_display_collection' , [ 'bas_id' => $ bas_id , 'success' => 0 , 'error' => 'file-too-big' , ] ) ; } if ( ! $ file -> isValid ( ) ) { return $ this -> app -> redirectPath ( 'admin_display_collection' , [ 'bas_id' => $ bas_id , 'success' => 0 , 'error' => 'file-invalid' , ] ) ; } $ collection = \ collection :: getByBaseId ( $ this -> app , $ bas_id ) ; try { $ this -> app -> getApplicationBox ( ) -> write_collection_pic ( $ this -> app [ 'media-alchemyst' ] , $ this -> app [ 'filesystem' ] , $ collection , $ file , \ collection :: PIC_STAMP ) ; $ this -> app [ 'filesystem' ] -> remove ( $ file -> getPathname ( ) ) ; } catch ( \ Exception $ e ) { return $ this -> app -> redirectPath ( 'admin_display_collection' , [ 'bas_id' => $ bas_id , 'success' => 0 , 'error' => 'file-error' , ] ) ; } return $ this -> app -> redirectPath ( 'admin_display_collection' , [ 'bas_id' => $ bas_id , 'success' => 1 , ] ) ; }
Set a collection stamp

@param  Request          $request The current request
@param  integer          $bas_id  The collection base_id
@return Response
Set a collection stamp