Example #1
0
 public function includeArtMeta(ContestEntry $entry)
 {
     if ($entry->contest->type !== 'art' || !presence($entry->entry_url)) {
         return $this->item($entry, function ($entry) {
             return [];
         });
     }
     return $this->item($entry, function ($entry) {
         $size = fast_imagesize($entry->entry_url);
         return ['width' => $size[0], 'height' => $size[1]];
     });
 }
Example #2
0
                <div class="row">
                    <div class="col-md-12">
                        {!! Markdown::convertToHtml($product->description) !!}
                    </div>
                </div>

                @include("store.products.{$product->custom_class}")

            @else
            <div class="row">
                <div class="col-md-6">
                    <div class="gallery-previews">
                        @foreach($product->images() as $i => $image)
                            <?php 
$imageSize = fast_imagesize($image[1]);
?>
                            <a
                                class="gallery-previews__item js-gallery"
                                data-width="{{ $imageSize[0] }}"
                                data-height="{{ $imageSize[1] }}"
                                data-gallery-id="product-{{ $product->product_id }}"
                                data-index="{{ $i }}"
                                href="{{ $image[1] }}"
                                style="background-image: url('{{ $image[1] }}');"
                                data-visibility="{{ $loop->first ? '' : 'hidden' }}"
                            ></a>
                        @endforeach
                    </div>
                    <div class="gallery-thumbnails">
                        @foreach($product->images() as $i => $image)
Example #3
0
 public function parseImage($text)
 {
     preg_match_all("#\\[img:{$this->uid}\\](?<url>[^[]+)\\[/img:{$this->uid}\\]#", $text, $images, PREG_SET_ORDER);
     $index = 0;
     foreach ($images as $i) {
         $proxiedSrc = proxy_image($i['url']);
         $imageTag = '';
         $imageSize = fast_imagesize($proxiedSrc);
         if ($imageSize !== false && $imageSize[0] !== 0) {
             $heightPercentage = $imageSize[1] / $imageSize[0] * 100;
             $topClass = 'proportional-container';
             if ($this->withGallery) {
                 $topClass .= ' js-gallery';
             }
             $imageTag .= "<span class='{$topClass}' style='width: {$imageSize[0]}px;' data-width='{$imageSize[0]}' data-height='{$imageSize[1]}' data-index='{$index}' data-gallery-id='{$this->refId}' data-src='{$proxiedSrc}'>";
             $imageTag .= "<span class='proportional-container__height' style='padding-bottom: {$heightPercentage}%;'>";
             $imageTag .= lazy_load_image($proxiedSrc, 'proportional-container__content');
             $imageTag .= '</span>';
             $imageTag .= '</span>';
             $index += 1;
         } else {
             $imageTag .= lazy_load_image($proxiedSrc);
         }
         $text = str_replace($i[0], $imageTag, $text);
     }
     return $text;
 }