public function getList()
 {
     $thumbs = [];
     $themesPath = base_path('resources/views/themes');
     if (is_dir($themesPath)) {
         foreach (Theme::all() as $databaseTheme) {
             $databaseThemes[$databaseTheme->theme] = $databaseTheme;
         }
         foreach (scandir($themesPath) as $themeFile) {
             if (!is_dir($themesPath . '/' . $themeFile) && substr($themeFile, -4) == '.zip') {
                 Theme::unzip($themeFile);
             }
         }
         foreach (scandir($themesPath) as $themeFolder) {
             if (is_dir($themesPath . '/' . $themeFolder) && strpos($themeFolder, '.') !== 0) {
                 $theme = new \stdClass();
                 $theme->name = $themeFolder;
                 $theme->image = 'https://placeholdit.imgix.net/~text?txtsize=19&bg=efefef&txtclr=aaaaaa%26text%3Dno%2Bimage&txt=no+image&w=200&h=150';
                 $publicLocations = [public_path('themes/' . $themeFolder), $themesPath . '/' . $themeFolder . '/public'];
                 foreach ($publicLocations as $k => $publicLocation) {
                     if (is_dir($publicLocation)) {
                         foreach (scandir($publicLocation) as $file) {
                             if (!is_dir($publicLocation . '/' . $file)) {
                                 if (strpos($file, 'screenshot.') === 0) {
                                     if ($k == 0) {
                                         $theme->image = \Croppa::url(URL::to('themes/' . $themeFolder . '/' . $file), 252, 142);
                                     } else {
                                         $saveInCache = public_path('coaster/tmp/themes/' . $themeFolder);
                                         @mkdir($saveInCache, 0777, true);
                                         copy($publicLocation . '/' . $file, $saveInCache . '/' . $file);
                                         $theme->image = \Croppa::url(URL::to('coaster/tmp/themes/' . $themeFolder . '/' . $file), 252, 142);
                                     }
                                 }
                             }
                         }
                     }
                 }
                 if (isset($databaseThemes[$themeFolder])) {
                     $theme->id = $databaseThemes[$themeFolder]->id;
                     if ($databaseThemes[$themeFolder]->id != config('coaster::frontend.theme')) {
                         $theme->activate = 1;
                     } else {
                         $theme->active = 1;
                     }
                 } else {
                     $theme->install = 1;
                 }
                 $thumbs[] = $theme;
             }
         }
     }
     $theme_auth = ['update' => Auth::action('themes.update'), 'manage' => Auth::action('themes.manage'), 'export' => Auth::action('themes.export'), 'edit' => Auth::action('themes.edit')];
     $themes_installed = View::make('coaster::partials.themes.thumbs', ['thumbs' => $thumbs, 'auth' => $theme_auth]);
     if (!empty(self::$_error)) {
         $this->addAlert('danger', self::$_error);
     }
     $this->layoutData['content'] = View::make('coaster::pages.themes.list', ['themes_installed' => $themes_installed, 'can_upload' => $theme_auth['manage']]);
     $this->layoutData['modals'] = View::make('coaster::modals.themes.delete')->render() . View::make('coaster::modals.themes.export')->render() . View::make('coaster::modals.themes.install')->render() . View::make('coaster::modals.themes.install_confirm')->render() . View::make('coaster::modals.themes.install_error')->render();
 }
Exemple #2
0
 /**
  * Display image, image can be cropped with croppa
  * @param string $content
  * @param array $options
  * @return string
  */
 public function display($content, $options = [])
 {
     $imageData = $this->_defaultData($content);
     if (empty($imageData->file)) {
         return '';
     }
     if (empty($imageData->title)) {
         if (empty($options['title'])) {
             $fileName = substr(strrchr($imageData->file, '/'), 1);
             $imageData->title = str_replace('_', ' ', preg_replace('/\\.[^.\\s]{3,4}$/', '', $fileName));
         } else {
             $imageData->title = $options['title'];
         }
     }
     $imageData->extra_attrs = '';
     $ignoreAttributes = ['height', 'width', 'group', 'view', 'title', 'croppaOptions', 'version'];
     foreach ($options as $option => $val) {
         if (!in_array($option, $ignoreAttributes)) {
             $imageData->extra_attrs .= $option . '="' . $val . '" ';
         }
     }
     $imageData->group = !empty($options['group']) ? $options['group'] : '';
     $imageData->original = URL::to($imageData->file);
     $height = !empty($options['height']) ? $options['height'] : null;
     $width = !empty($options['width']) ? $options['width'] : null;
     if ($height || $width) {
         $croppaOptions = !empty($options['croppaOptions']) ? $options['croppaOptions'] : [];
         $imageData->file = str_replace(URL::to('/'), '', $imageData->file);
         $imageData->file = \Croppa::url($imageData->file, $width, $height, $croppaOptions);
     } else {
         $imageData->file = $imageData->original;
     }
     $template = !empty($options['view']) ? $options['view'] : 'default';
     $imageViews = 'themes.' . PageBuilder::getData('theme') . '.blocks.images.';
     if (View::exists($imageViews . $template)) {
         return View::make($imageViews . $template, array('image' => $imageData))->render();
     } else {
         return 'Image template not found';
     }
 }
Exemple #3
0
 public function get_thumb($width = 64, $height = 64)
 {
     $file_url = 'uploads/categories/thumbs/' . $this->id . '.png';
     return File::exists($file_url) ? asset(Croppa::url($file_url, $width, $height)) : 'http://placehold.it/' . $width . 'x' . $height . '/ccc/ccc';
 }
            <!-- widget div-->
            <div role="content" class="">
                <!-- widget content -->
                <div class="widget-body">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <div class="form-group">
                            <button type="submit" class="btn btn-primary"><i class="fa fa-cog"></i>Save &amp; Publish</button>
                            <!--<a class="btn btn-primary" href="javascript:void(0);"><i class="fa fa-cog"></i> Save &amp; Publish</a>-->
                        </div>
                        <hr>
                        <div class="form-group">
                            <div class="col-md-12" style="margin: 0; padding: 0">
                                <div id="imgg" style="background-color: #c3c3c3; padding: 10px; text-align: center">
                                    <?php 
if ($myproduct->image != "") {
    echo "<img alt='' src='" . \Croppa::url(ASSETS_URL . '/uploads/images/thumbs/' . $myproduct->image, 100, 100) . "' />";
} else {
    echo "<i class='fa fa-camera fa-5x'></i>";
}
?>

                                </div>
                                <a class="inline2" href="#inline_content2" id="dd">Browse</a>
                                <input class="form-control" id="sort_order" name="sort_order" placeholder="Sort Order" value="{{$myproduct->sort_order}}" type="text">
                                <input type="hidden" id="image" name="image" value="{{$myproduct->image}}">
                                <input type="hidden" id="oldimage" name="oldimage" value="{{$myproduct->image}}">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-12">
                                <label class="checkbox-inline">
Exemple #5
0
 public function getAvatarUrl($size)
 {
     if (!empty($this->avatar)) {
         $src_filename = sprintf('/uploads/users/%d/%s', $this->id, $this->avatar);
         if (is_file(public_path() . $src_filename)) {
             $result = Croppa::url($src_filename, $size, $size, array('resize'));
             //$result = preg_replace('!^(.+)\?.+$!', '$1', $result);
             return $result;
         }
     }
     return "http://www.gravatar.com/avatar/" . md5(strtolower(trim($this->email))) . "?d=mm&s=" . $size;
 }
Exemple #6
0
	.gallery-image:hover
	{
		background-position: 0px -20px;
		filter: drop-shadow(0px 2px 4px #222222);
	}
</style>

<h1>{{ $item->title }}</h1>
<strong>{{ date('d.m.Y', strtotime($item->updated_at)) }}</strong>

<?php 
$root_dir = 'uploads';
$package_name = 'gallery';
$id_gallery = $item->{$item->getKeyName()};
$id_language = 0;
//language independent field
$column_name = 'images';
$images = Neonbug\Gallery\Models\GalleryImage::where('id_row', $item->{$item->getKeyName()})->where('column_name', $column_name)->orderBy('ord')->get();
?>

<div class="gallery-images">
	@foreach ($images as $image)
		<?php 
$image_path = implode('/', [$root_dir, $package_name, $id_gallery, $id_language, $column_name, $image->image]);
$url = Croppa::url($image_path);
$thumb = Croppa::url($image_path, 180, 120);
?>
		<a target="_blank" class="gallery-image" href="{{ $url }}" style="background-image: url('{{ $thumb }}');"></a>
	@endforeach
</div>
                                            <th data-class="expand">Img</th>
                                            <th data-hide="phone">Category Name</th>
                                            <th data-hide="phone">Sort Order</th>
                                            <th data-hide="phone,tablet">Date Crreated</th>
                                            <th data-hide="phone,tablet">Date Modified</th>
                                            <th data-hide="phone">Action</th>
                                        </tr>
                                        </thead>
                                        <tbody id="listdata">
                                        @if($categories)
                                        {{--*/$x=1/*--}}
                                        @foreach($categories as $category)
                                        <tr>
                                            <td>{{$x}}</td>
                                            <td><?php 
echo "<img src='" . \Croppa::url(ASSETS_URL . "/uploads/images/thumbs/" . $category->image, 50, 50) . "' >";
?>
</td>
                                            <td>{{$category->title}}</td>
                                            <td>{{$category->sort_order}}</td>
                                            <td>{{date_format(date_create($category->created_at),"d-m-Y")}}</td>
                                            <td>{{date_format(date_create($category->updated_at),"d-m-Y")}}</td>
                                            <td>{{HTML::linkRoute('editpcategory',"Edit",$category->id)}}</td>
                                        </tr>
                                        {{--*/$x++/*--}}
                                        @endforeach
                                        @else
                                        <td colspan="6" >No listing available</td>
                                        @endif
                                        </tbody>
                                    </table>