Ejemplo n.º 1
0
 /**
  * @param array|string $data
  * @param null $defaultImage
  */
 public function __construct($data, $defaultImage = null)
 {
     if (is_string($data)) {
         $data = $this->parseStr($data);
     }
     if (!empty($data['imageOrig']) && file_exists(ipFile('file/repository/' . $data['imageOrig']))) {
         $this->imageOrig = $data['imageOrig'];
         if (isset($data['x1']) && isset($data['y1']) && isset($data['x2']) && isset($data['y2'])) {
             $this->x1 = $data['x1'];
             $this->y1 = $data['y1'];
             $this->x2 = $data['x2'];
             $this->y2 = $data['y2'];
             if (empty($data['requiredWidth'])) {
                 $data['requiredWidth'] = $this->x2 - $this->x1;
             }
             if (empty($data['requiredHeight'])) {
                 $data['requiredHeight'] = $this->y2 - $this->y1;
             }
             $this->requiredWidth = $data['requiredWidth'];
             $this->requiredHeight = $data['requiredHeight'];
             $transform = array('type' => 'crop', 'x1' => $this->getX1(), 'y1' => $this->getY1(), 'x2' => $this->getX2(), 'y2' => $this->getY2(), 'width' => $this->getRequiredWidth(), 'height' => $this->getRequiredHeight());
             $this->image = ipFileUrl(ipReflection($this->getImageOrig(), $transform, null));
         }
     } else {
         $this->image = $defaultImage;
     }
     if (!empty($data['id'])) {
         $this->id = $data['id'];
     } else {
         $this->id = mt_rand(2, 2147483647);
         //1 used for inline logo
     }
 }
Ejemplo n.º 2
0
 public function generateHtml($revisionId, $widgetId, $data, $skin)
 {
     $data['block'] = ipBlock('block_' . $widgetId)->exampleContent('')->render($revisionId);
     $data['widgetId'] = $widgetId;
     if (isset($data['background_image']) && $data['background_image']) {
         $data['background_image'] = ipReflection($data['background_image'], array('type' => 'fit', 'width' => isset($data['width']) ? $data['width'] : 960, 'height' => isset($data['height']) ? $data['height'] : 460, 'quality' => 60));
     }
     return parent::generateHtml($revisionId, $widgetId, $data, $skin);
 }
Ejemplo n.º 3
0
 /**
  * @param array|string $data
  * @param string $defaultLogo
  */
 public function __construct($data, $defaultLogo = null)
 {
     if (is_string($data)) {
         $data = $this->parseStr($data);
     }
     if (!isset($data['type'])) {
         if ($defaultLogo) {
             $data['type'] = self::TYPE_IMAGE;
         } else {
             $data['type'] = self::TYPE_TEXT;
         }
     }
     switch ($data['type']) {
         case self::TYPE_TEXT:
             $this->type = self::TYPE_TEXT;
             break;
         case self::TYPE_IMAGE:
             $this->type = self::TYPE_IMAGE;
             break;
         default:
             $this->type = self::TYPE_TEXT;
             break;
     }
     if (!empty($data['imageOrig']) && file_exists(ipFile('file/repository/' . $data['imageOrig']))) {
         $this->imageOrig = $data['imageOrig'];
         if (isset($data['x1']) && isset($data['y1']) && isset($data['x2']) && isset($data['y2'])) {
             $this->x1 = $data['x1'];
             $this->y1 = $data['y1'];
             $this->x2 = $data['x2'];
             $this->y2 = $data['y2'];
             if (empty($data['requiredWidth'])) {
                 $data['requiredWidth'] = $this->x2 - $this->x1;
             }
             if (empty($data['requiredHeight'])) {
                 $data['requiredHeight'] = $this->y2 - $this->y1;
             }
             $this->requiredWidth = $data['requiredWidth'];
             $this->requiredHeight = $data['requiredHeight'];
             $transform = array('type' => 'crop', 'x1' => $this->getX1(), 'y1' => $this->getY1(), 'x2' => $this->getX2(), 'y2' => $this->getY2(), 'width' => $this->getRequiredWidth(), 'height' => $this->getRequiredHeight(), 'quality' => 100);
             $requestedName = \Ip\Internal\Text\Specialchars::url(ipGetOptionLang('Config.websiteTitle'));
             $this->image = ipReflection($this->getImageOrig(), $transform, $requestedName);
         }
     } else {
         $this->image = $defaultLogo;
     }
     if (!empty($data['text'])) {
         $this->setText($data['text']);
     } else {
         $this->setText(ipGetOptionLang('Config.websiteTitle'));
     }
     if (isset($data['color'])) {
         $this->setColor($data['color']);
     }
     if (isset($data['font'])) {
         $this->setFont($data['font']);
     }
 }
Ejemplo n.º 4
0
 public static function showImage($value, $recordData = null)
 {
     if ($value) {
         $transform = array('type' => 'fit', 'width' => 100, 'height' => 100);
         $thumbnailUrl = ipReflection($value, $transform, 'preview.jpg');
         $imageHtml = '<a href="' . ipFileUrl('file/repository/' . $value) . '" target="blank"><img src="' . $thumbnailUrl . '" alt="' . esc($value) . '"></a>';
         return $imageHtml;
     } else {
         return false;
     }
 }
Ejemplo n.º 5
0
 function img($varname, $default, $width, $height, $class = '', $tagname = 'img')
 {
     $varname = $this->num != -1 ? $varname . '-' . $this->num : $varname;
     $defaultval = ipThemeUrl('assets/') . $default;
     if (array_key_exists($varname, $this->data)) {
         $fileName = $this->data[$varname]['fileName'];
         $transform = array('type' => 'crop', 'x1' => $this->data[$varname]['crop']['x1'], 'y1' => $this->data[$varname]['crop']['y1'], 'x2' => $this->data[$varname]['crop']['x2'], 'y2' => $this->data[$varname]['crop']['y2'], 'width' => $width, 'height' => $height);
         $url = ipFileUrl(ipReflection($fileName, $transform, $fileName));
         $imgdata = escAttr(json_encode($this->data[$varname]));
     } else {
         $url = $defaultval;
         $imgdata = "";
     }
     return "<{$tagname} class=\"ipsEditable {$class}\" data-type=\"Image\" data-varname=\"{$varname}\"\n\t\t\t\t\tdata-cssclass=\"{$class}\" data-image=\"{$imgdata}\" src=\"{$url}\"/>";
 }
Ejemplo n.º 6
0
 public static function bkgImage($data)
 {
     $imageFiles = Service::pageImages();
     $images = array();
     foreach ($imageFiles as $image) {
         $file = $image;
         $options = array('type' => 'copy');
         $copiedImage = ipReflection($file, $options);
         if (!$copiedImage) {
             echo ipReflectionException();
         } else {
             $images[] = ipFileUrl($copiedImage);
         }
     }
     $answer = ipView('view/slot2.php', array('images' => $images))->render();
     return $answer;
 }
Ejemplo n.º 7
0
 public function generateHtml($revisionId, $widgetId, $data, $skin)
 {
     $items = Model::widgetItems($widgetId);
     // If it has not been configured yet, sets some default values
     if (empty($data['options'])) {
         $data['options'] = array('gutter' => 10, 'columnWidth' => 320, 'isFitWidth' => true, 'isOriginLeft' => true);
     }
     $image_options = array('type' => 'width', 'width' => $data['options']['columnWidth'] - 10);
     foreach ($items as $key => $item) {
         // Clean Up the URL
         $link = '';
         if ($item['url'] != '') {
             $protocol = parse_url($item['url'], PHP_URL_SCHEME);
             $target = '_self';
             $base_url = ipConfig()->baseUrl();
             // If it is an absolute URL don't make any transformation
             if ($protocol == 'http' or $protocol == 'https') {
                 $link = $item['url'];
                 // If the URL is pointing to another domain, open in a new page.
                 if (strpos($link, $base_url) === false) {
                     $target = '_blank';
                 }
             } else {
                 // Asume it is a reference to a local page
                 $link = ipFileUrl($item['url']);
             }
             $items[$key]['link_target'] = $target;
         }
         $items[$key]['clean_url'] = $link;
         // Create Image path
         $items[$key]['image_url'] = ipFileUrl(ipReflection($item['image'], $image_options));
     }
     $data['container_id'] = "masonry_wd_{$widgetId}";
     $data['widgetId'] = $widgetId;
     $data['items'] = $items;
     return parent::generateHtml($revisionId, $widgetId, $data, $skin);
 }
Ejemplo n.º 8
0
 protected function cropSmallImage($curImage)
 {
     $smallImageUrl = null;
     if (isset($curImage['cropX1']) && isset($curImage['cropY1']) && isset($curImage['cropX2']) && isset($curImage['cropY2'])) {
         $transformSmall = array('type' => 'crop', 'x1' => $curImage['cropX1'], 'y1' => $curImage['cropY1'], 'x2' => $curImage['cropX2'], 'y2' => $curImage['cropY2'], 'width' => ipGetOption('Content.widgetGalleryWidth'), 'height' => ipGetOption('Content.widgetGalleryHeight'), 'quality' => ipGetOption('Content.widgetGalleryQuality'));
     } else {
         $transformSmall = array('type' => 'center', 'width' => ipGetOption('Content.widgetGalleryWidth'), 'height' => ipGetOption('Content.widgetGalleryHeight'), 'quality' => ipGetOption('Content.widgetGalleryQuality'));
     }
     $smallImageUrl = ipFileUrl(ipReflection($curImage['imageOriginal'], $transformSmall, $curImage['title']));
     return $smallImageUrl;
 }
Ejemplo n.º 9
0
 public function generateHtml($revisionId, $widgetId, $data, $skin)
 {
     $data['widgetId'] = $widgetId;
     if (isset($data['images']) && is_array($data['images'])) {
         //loop all current images
         foreach ($data['images'] as &$curImage) {
             if (empty($curImage['imageOriginal'])) {
                 continue;
             }
             $desiredName = isset($curImage['title']) ? $curImage['title'] : null;
             //create big image reflection
             $bigWidth = !empty($data['options']['width']) ? $data['options']['width'] : ipGetOption('AsdSlider.imageWidth');
             $bigHeight = !empty($data['options']['height']) ? $data['options']['height'] : ipGetOption('AsdSlider.imageHeight');
             $transformBig = array('type' => 'fit', 'width' => ipGetOption('AsdSlider.bigImageWidth'), 'height' => ipGetOption('AsdSlider.bigImageHeight'));
             $curImage['imageBig'] = ipFileUrl(ipReflection($curImage['imageOriginal'], $transformBig, $desiredName));
             if (isset($curImage['cropX1']) && isset($curImage['cropY1']) && isset($curImage['cropX2']) && isset($curImage['cropY2'])) {
                 $transformSmall = array('type' => 'crop', 'x1' => $curImage['cropX1'], 'y1' => $curImage['cropY1'], 'x2' => $curImage['cropX2'], 'y2' => $curImage['cropY2'], 'width' => $bigWidth, 'height' => $bigHeight, 'quality' => ipGetOption('Content.widgetGalleryQuality'));
             } else {
                 $transformSmall = array('type' => 'center', 'width' => $bigWidth, 'height' => $bigHeight, 'quality' => ipGetOption('Content.widgetGalleryQuality'));
             }
             $curImage['imageSmall'] = ipFileUrl(ipReflection($curImage['imageOriginal'], $transformSmall, $curImage['title']));
             if (empty($curImage['type'])) {
                 $curImage['type'] = 'lightbox';
             }
             if (empty($curImage['url'])) {
                 $curImage['url'] = '';
             } else {
                 if (!preg_match('/^((http|https):\\/\\/)/i', $curImage['url'])) {
                     $curImage['url'] = 'http://' . $curImage['url'];
                 }
             }
             if (empty($curImage['blank'])) {
                 $curImage['blank'] = '';
             }
             if (empty($curImage['title'])) {
                 $curImage['title'] = '';
             }
         }
     }
     return parent::generateHtml($revisionId, $widgetId, $data, $skin);
 }
Ejemplo n.º 10
0
 /**
  * Get preview file for file browser
  * @param string $file
  * @return string
  */
 private function createPreview($file)
 {
     $pathInfo = pathinfo($file);
     $ext = strtolower(isset($pathInfo['extension']) ? $pathInfo['extension'] : '');
     $baseName = $pathInfo['basename'];
     if (in_array($ext, $this->supportedImageExtensions)) {
         $transform = array('type' => 'fit', 'width' => 140, 'height' => 140, 'forced' => true);
         $reflection = ipReflection($file, $transform, $baseName);
         if ($reflection) {
             return ipFileUrl($reflection);
         }
     }
     return ipFileUrl('Ip/Internal/Repository/assets/icons/general.png');
 }
Ejemplo n.º 11
0
if (!empty($data['pages']['pages'])) {
    ?>
    <?php 
    foreach ($data['pages']['pages'] as $page) {
        ?>
        <div class="asdBlog-post <?php 
        echo $animation;
        ?>
">
            <div class="asdBlog-intro">
                <?php 
        if (!empty($page['image']['imageOriginal']) && !empty($data['blog']['image']['enable'])) {
            ?>
                    <div class="asd-blog-image">
                        <?php 
            echo '<img src="' . ipFileUrl(ipReflection($page['image']['imageOriginal'], array('type' => 'center', 'width' => 980, 'height' => 360, 'quality' => 80, 'forced' => false))) . '" alt="' . $page['title'] . '" />';
            ?>
                    </div>
                <?php 
        }
        ?>
            </div>
            <h2>
                <?php 
        if (!empty($data['blog']['options']['titlelink'])) {
            ?>
                    <a href="<?php 
            echo $page['urlPath'];
            ?>
"><?php 
            echo esc($page['title']);
Ejemplo n.º 12
0
 public static function imageView($value, $recordData)
 {
     $thumb_options = array('type' => 'fit', 'width' => 100, 'height' => 100);
     $thumbnail = ipFileUrl(ipReflection($value, $thumb_options));
     return "<img src='{$thumbnail}' border='0'/>";
 }
Ejemplo n.º 13
0
 public function generateHtml($revisionId, $widgetId, $data, $skin)
 {
     if (isset($data['imageOriginal'])) {
         $desiredName = isset($data['title']) ? $data['title'] : null;
         $transformBig = array('type' => 'copy');
         $data['imageBig'] = ipFileUrl(ipReflection($data['imageOriginal'], $transformBig, $desiredName));
         if (!empty($data['url']) && !preg_match('/^((http|https):\\/\\/)/i', $data['url'])) {
             $data['url'] = 'http://' . $data['url'];
         }
         if (isset($data['cropX1']) && isset($data['cropY1']) && isset($data['cropX2']) && isset($data['cropY2']) && $data['cropY2'] - $data['cropY1'] > 0) {
             if (!empty($data['width'])) {
                 $width = $data['width'];
             } else {
                 $width = ipGetOption('Content.widgetImageWidth', 1200);
             }
             if ($width <= 0) {
                 $width = 1200;
             }
             //calc height
             $ratio = ($data['cropX2'] - $data['cropX1']) / ($data['cropY2'] - $data['cropY1']);
             if ($ratio == 0) {
                 $ratio = 1;
             }
             $height = round($width / $ratio);
             $transform = array('type' => 'crop', 'x1' => $data['cropX1'], 'y1' => $data['cropY1'], 'x2' => $data['cropX2'], 'y2' => $data['cropY2'], 'width' => $width, 'height' => $height, 'forced' => true);
             $data['imageSmall'] = ipFileUrl(ipReflection($data['imageOriginal'], $transform, $desiredName));
         } else {
             $forced = false;
             if (!empty($data['width'])) {
                 $width = $data['width'];
                 $forced = true;
             } else {
                 $width = ipGetOption('Content.widgetImageWidth', 1200);
             }
             if (!empty($data['height'])) {
                 $height = $data['height'];
                 $forced = true;
             } else {
                 $height = ipGetOption('Content.widgetImageHeight', 900);
             }
             $transform = array('type' => 'fit', 'width' => $width, 'height' => $height, 'forced' => $forced);
         }
         $data['imageSmall'] = ipFileUrl(ipReflection($data['imageOriginal'], $transform, $desiredName));
         if (empty($data['type'])) {
             $data['type'] = 'lightbox';
         }
         if (empty($data['url'])) {
             $data['url'] = '';
         }
         if (empty($data['blank'])) {
             $data['blank'] = '';
         }
         if (empty($data['nofollow'])) {
             $data['nofollow'] = '';
         }
         if (empty($data['title'])) {
             $data['title'] = '';
         }
         if (empty($data['description'])) {
             $data['description'] = '';
         }
     }
     return parent::generateHtml($revisionId, $widgetId, $data, $skin);
 }
Ejemplo n.º 14
0
 if (!empty($data['blog']['info']['category']) && $data['blog']['info']['category'] == 1 && !empty($data['pages']['categories'][$page['parentId']]['title'])) {
     ?>
             <?php 
     echo esc($data['pages']['categories'][$page['parentId']]['title']);
     ?>
         <?php 
 }
 ?>
     </div>
     <div class="asdBlog-intro">
         <?php 
 if (!empty($page['image']['imageOriginal']) && !empty($data['blog']['image']['enable'])) {
     ?>
             <div class="asd-blog-image">
                 <?php 
     echo '<img src="' . ipFileUrl(ipReflection($page['image']['imageOriginal'], $imageOptions)) . '" alt="' . $page['title'] . '" />';
     ?>
             </div>
         <?php 
 }
 ?>
         <?php 
 echo $page['intro'];
 ?>
     </div>
     <div class="asdBlog-info-bottom">
         <?php 
 if (!empty($data['blog']['info']['date']) && $data['blog']['info']['date'] == 2) {
     ?>
             <?php 
     echo date(ipGetOption('AsdBlog.dateFormat'), strtotime($page['createdAt']));
Ejemplo n.º 15
0
<div class="portfolio-item">

    <?php 
if (!empty($tile['imagelink'])) {
    ?>
    <img src="<?php 
    echo ipFileUrl(ipReflection($tile['imagelink'], array('type' => 'width', 'width' => 400, 'forced' => true)));
    ?>
" alt="" />
    <?php 
}
?>
    
    <?php 
if (!empty($tile['pagelink'])) {
    ?>
    <a href="<?php 
    echo $tile['pagelink'];
    ?>
">
        <div class="portfolio-desc align-center">
                    
            <div class="folio-info">
                <h4><?php 
    echo empty($tile['title']) ? null : $tile['title'];
    ?>
</h4>
                <h5><?php 
    echo empty($tile['description']) ? null : $tile['description'];
    ?>
</h5>
Ejemplo n.º 16
0
		<?php 
foreach ($items as $key => $val) {
    ?>
		<div class="item <?php 
    if ($key == 0) {
        echo 'active';
    }
    ?>
">
			<a href="<?php 
    echo $val['url'];
    ?>
">
				<?php 
    $options = array('type' => 'center', 'width' => ipGetOption('SlideShow.imageWidth', 1121), 'height' => ipGetOption('SlideShow.imageHeight', 397));
    $thumbnail = ipReflection($val['image'], $options);
    if (!$thumbnail) {
        $thumbnail = ipReflectionException();
    } else {
        $thumbnail = ipFileUrl($thumbnail);
    }
    ?>
				<img class="img-responsive" src="<?php 
    echo $thumbnail;
    ?>
" alt="" />
				<?php 
    if (!empty($val['text'])) {
        ?>
				<div class="carousel-caption">
					<div class="col-xs-4 col-xs-push-8">