Esempio n. 1
0
 public function getAvatar($size = 100)
 {
     if (empty($this->entity->logo)) {
         return \Theme::asset()->img('theme/images/game/logo.jpg');
     }
     return \Image::url($this->entity->logo, $size);
 }
 public function render($path, $param = [], $setting = [])
 {
     $predefinedSettings = ['title' => $this->setTitle()];
     if ($this->exists()) {
         $predefinedSettings = array_merge($predefinedSettings, ['design' => $this->community->present()->readDesign()]);
     }
     $settings = array_merge($predefinedSettings, $setting);
     if (\Config::get('page-design') and isset($settings['design'])) {
         extract($settings['design']);
         $bgImage = !empty($bg_image) ? 'background-image:url(' . \Image::url($bg_image) . ');' : null;
         $this->theme->asset()->afterStyleContent("\n                body{\n                    " . $bgImage . "\n                    background-position: " . $bg_position . ";\n                    background-color: " . $bg_color . ";\n                    background-repeat: " . $bg_repeat . ";\n                    background-attachment : " . $bg_attachment . ";\n                }\n\n                a {\n                    color : " . $link_color . ";\n                }\n\n                .page-content{\n                    background-color: " . $content_bg_color . ";\n                }\n            ");
     }
     return parent::render('community.page.layout', ['content' => $this->theme->section($path, $param)], $settings);
 }
    public function update(Image $image)
    {
        $query = $this->_db->prepare(' UPDATE t_image SET 
		name=:name, url=:url, description=:description, idProjet=:idProjet, updated=:updated, updatedBy=:updatedBy
		WHERE id=:id') or die(print_r($this->_db->errorInfo()));
        $query->bindValue(':id', $image->id());
        $query->bindValue(':name', $image->name());
        $query->bindValue(':url', $image->url());
        $query->bindValue(':description', $image->description());
        $query->bindValue(':idProjet', $image->idProjet());
        $query->bindValue(':updated', $image->updated());
        $query->bindValue(':updatedBy', $image->updatedBy());
        $query->execute();
        $query->closeCursor();
    }
 /**
  * Ajax serving
  */
 public function uploadBg()
 {
     $error = json_encode(['response' => 0, 'message' => trans('photo.error', ['size' => formatBytes()])]);
     if (\Request::hasFile('image')) {
         if (!$this->photoRepository->imagesMetSizes(\Input::file('image'))) {
             return $error;
         }
         if ($image = $this->userRepository->changeDesignBg(\Input::file('image'), \Input::get('val.bg_image'))) {
             return json_encode(['response' => 1, 'image' => \Image::url($image), 'imagePath' => $image]);
         } else {
             return $error;
         }
     }
     return $error;
 }
Esempio n. 5
0
 public function changePhoto()
 {
     $id = \Input::get('id');
     $game = $this->gameRepository->get($id);
     $response = ['code' => 0, 'message' => trans('photo.error', ['size' => formatBytes()]), 'url' => ''];
     if (\Request::hasFile('image')) {
         if (!$this->photoRepository->imagesMetSizes(\Input::file('image'))) {
             return json_encode($response);
         }
         $image = $this->gameRepository->changePhoto(\Input::file('image'), $game);
         if ($image) {
             $response['code'] = 1;
             $response['url'] = \Image::url($image, 100);
         }
     }
     return json_encode($response);
 }
Esempio n. 6
0
 public function render($path, $param = [], $setting = [])
 {
     $predefinedSettings = [];
     if (\Auth::check()) {
         /**
          * If there is login we help this user to design his page
          */
         $predefinedSettings = array_merge($predefinedSettings, ['design' => \Auth::user()->present()->readDesign()]);
     }
     $settings = array_merge($predefinedSettings, $setting);
     if (\Config::get('page-design') and isset($settings['design'])) {
         extract($settings['design']);
         $bgImage = !empty($bg_image) ? 'background-image:url(' . \Image::url($bg_image) . ');' : 'background-image : none';
         $this->theme->asset()->afterStyleContent("\n                body{\n                    " . $bgImage . "\n                    background-position: " . $bg_position . ";\n                    background-color: " . $bg_color . ";\n                    background-repeat: " . $bg_repeat . ";\n                    background-attachment : " . $bg_attachment . ";\n                }\n\n                a {\n                    color : " . $link_color . ";\n                }\n\n                .page-content{\n                    background-color: " . $content_bg_color . ";\n                }\n            ");
     }
     return parent::render($path, $param, $settings);
 }
Esempio n. 7
0
 public function cropCover($id)
 {
     $top = \Input::get('top');
     $failed = json_encode(['status' => 'error', 'message' => trans('photo.error', ['size' => formatBytes()])]);
     $page = $this->pageRepository->get($id);
     if (!$page or !$page->isOwner()) {
         return $failed;
     }
     $image = $this->photo->cropImage(base_path($page->original_cover), 'cover/', 0, abs($top), 1000, 300, false);
     $image = str_replace('%d', 'original', $image->result());
     if (!empty($image)) {
         /**
          * Update user profile cover
          */
         if ($page->cover and $page->cover != $page->original_cover) {
             \Image::delete($page->cover);
         }
         $page->cover = $image;
         $page->save();
         return json_encode(['status' => 'success', 'url' => \Image::url($image)]);
     } else {
         return json_encode(['status' => 'error', 'message' => 'Error things']);
     }
 }
Esempio n. 8
0
 public function testServeWrongFormat()
 {
     $url = Image::url('/wrong.jpg', 300, 300, array('crop' => true));
     $this->setExpectedException('Folklore\\Image\\Exception\\FormatException');
     $response = $this->call('GET', $url);
 }
Esempio n. 9
0
 public function cropCover()
 {
     $top = \Input::get('imgY1');
     $left = \Input::get('imgX1');
     $cWidth = \Input::get('cropW');
     $cHeight = \Input::get('cropH');
     $file = \Input::get('imgUrl');
     $file = str_replace([\URL::to(''), '//'], ['', '/'], $file);
     $id = \Input::get('id');
     $image = $this->photo->cropImage(base_path('') . $file, 'cover/', $left, $top, $cWidth, $cHeight, false);
     $image = str_replace('%d', 'original', $image->result());
     /**make sure to delete the original image***/
     $this->photo->delete($file);
     if (!empty($image)) {
         /**
          * Update user profile cover
          */
         $this->eventRepository->updateCover($id, $image);
         return json_encode(['status' => 'success', 'url' => \Image::url($image)]);
     } else {
         return json_encode(['status' => 'error', 'message' => 'Error ']);
     }
 }
Esempio n. 10
0
    @if ($user)

        <div class="col-xs-12">

            <div class="alert alert-info">Add new image by clicking on the + icon on the left sidebar.</div>

            <div class="grid">
                <div class="grid-sizer"></div>
                @foreach($images as $image)
                    <div class="grid-item {{ $image['status'] }}" data-id="{{ $image['id'] }}" data-status="{{ $image['status']  }}"
                         data-preview="<?php 
echo Image::url('/uploads/images/' . $image['path'], 400);
?>
">
                        <img src="<?php 
echo Image::url('/uploads/images/' . $image['path'], 200, 300);
?>
"/>
                    </div>
                @endforeach
            </div>

        </div>

    @else

        <div class="col-xs-12">

            <div class="well" style="background-color: #fff">

                <p>We use the OCR capability of Google Drive to perform the image to text conversion of your documents. Thus we need you to sign in using your Google Account and grant access to your Google Drive for performing the OCR.</p>
Esempio n. 11
0
 public function uploadImage()
 {
     $result = ['code' => 0, 'message' => trans('post.post-image-error')];
     if ($image = \Input::file('image')) {
         $uploadImage = $this->postRepository->uploadImage($image);
         if ($uploadImage) {
             $result['image'] = $uploadImage;
             $result['imageurl'] = \Image::url($uploadImage, 100);
             $result['code'] = 1;
         }
     }
     return json_encode($result);
 }
Esempio n. 12
0
 public function getLogo()
 {
     if (empty($this->entity->logo)) {
         return \Theme::asset()->img('theme/images/community/cover.jpg');
     }
     return \Image::url($this->entity->logo);
 }
Esempio n. 13
0
 public function readDesign($type = 'profile')
 {
     $design = ['enable' => false];
     $userDesign = !empty($this->entity->design_info) ? perfectUnserialize($this->entity->design_info) : [];
     $userDesign = !$userDesign ? [] : $userDesign;
     $design = array_merge($design, $userDesign);
     if (isset($design[$type])) {
         $design = $design[$type];
     }
     /**
      * @var $enable
      * @var $theme
      */
     extract($design);
     if ($enable) {
         $design['bg_image'] = \Image::url($design['bg_image']);
     }
     if (!$enable) {
         $themeDesign = \Theme::option()->get('design-themes');
         $themeDesign = (empty($theme) or !isset($themeDesign[$theme])) ? $themeDesign['default'] : $themeDesign[$theme];
         /**
          * Reset the design to this selected one
          */
         $design['bg_image'] = $themeDesign['background-image'];
         $design['bg_color'] = $themeDesign['background-color'];
         $design['bg_attachment'] = $themeDesign['background-attachment'];
         $design['bg_position'] = $themeDesign['background-position'];
         $design['bg_repeat'] = $themeDesign['background-repeat'];
         $design['link_color'] = $themeDesign['link-color'];
         $design['content_bg_color'] = $themeDesign['page-content-bg-color'];
     }
     return $design;
 }
Esempio n. 14
0
 public function cropCover()
 {
     $top = \Input::get('top');
     $image = $this->photo->cropImage(base_path(\Auth::getUser()->original_cover), 'cover/', 0, abs($top), 1000, 300, false);
     $image = str_replace('%d', 'original', $image->result());
     if (!empty($image)) {
         /**
          * Update user profile cover
          */
         $user = \Auth::user();
         if ($user->cover and $user->cover != $user->original_cover) {
             \Image::delete($user->cover);
         }
         $this->userRepository->updateCover($image);
         return json_encode(['status' => 'success', 'url' => \Image::url($image)]);
     } else {
         return json_encode(['status' => 'error', 'message' => 'Error things']);
     }
 }
Esempio n. 15
0
 public function coverImage()
 {
     if (!empty($this->entity->cover)) {
         return \Image::url($this->entity->cover);
     }
 }
Esempio n. 16
0
 public function getOriginalCover()
 {
     if ($this->entity->original_cover) {
         return \Image::url($this->entity->original_cover);
     }
 }