function ff_Gallery($output, $attr)
{
    static $instance = 0;
    $instance++;
    global $post;
    // We're trusting author input, so let's at least make sure it looks like a valid orderby statement
    if (isset($attr['orderby'])) {
        $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
        if (!$attr['orderby']) {
            unset($attr['orderby']);
        }
    }
    extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => ''), $attr));
    $gallery_ID = $id = intval($id);
    if ('RAND' == $order) {
        $orderby = 'none';
    }
    if (!empty($include)) {
        $include = preg_replace('/[^0-9,]+/', '', $include);
        $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
        $attachments = array();
        foreach ($_attachments as $key => $val) {
            $attachments[$val->ID] = $_attachments[$key];
        }
    } elseif (!empty($exclude)) {
        $exclude = preg_replace('/[^0-9,]+/', '', $exclude);
        $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    } else {
        $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    }
    if (empty($attachments)) {
        return '';
    }
    $output = "";
    global $ff_featured_width;
    global $ff_featured_height;
    $output .= '<div class="images-slider-2 blog-article-thumbnail">';
    $output .= '<ul>';
    $i = 0;
    foreach ($attachments as $id => $attachment) {
        $url = wp_get_attachment_url($id);
        if (empty($url)) {
            continue;
        }
        $url = fImg::resize($url, $ff_featured_width, $ff_featured_height, true);
        $output .= '<li>';
        $output .= '<img src="' . esc_url($url) . '" alt="">';
        $output .= '</li>' . "\n";
    }
    $output .= '</ul>';
    $output .= '</div>';
    return $output;
}
 public function actResizeAndServeImage($parameters)
 {
     if (!isset($parameters['image_name'])) {
         return false;
     }
     $imageOptionName = $parameters['image_name'];
     $imageData = $this->_getWPLayer()->get_option($imageOptionName);
     if ($imageData == null) {
         die;
     }
     $this->_getWPLayer()->delete_option($imageOptionName);
     ffContainer()->getClassLoader()->loadClass('externFreshizer');
     $newUrl = fImg::resize($imageData['url'], $imageData['width'], $imageData['height'], $imageData['crop'], false, false);
     $path = $this->_getFileSystem()->findFileFromUrl($newUrl);
     $this->_getImageServingObject()->serveImage($path);
 }
 public function printComponent($args, ffOptionsQuery $query)
 {
     $categories = $query->getMultipleSelect('latest-news categories');
     $numberOfPosts = $query->get('latest-news number-of-posts');
     $postGetter = ffContainer()->getPostLayer()->getPostGetter();
     $posts = $postGetter->setFilterRelation_OR()->setNumberOfPosts($numberOfPosts)->filterByCategory($categories)->getAllPosts();
     echo $args['before_widget'];
     echo $args['before_title'];
     echo ff_wp_kses($query->get('latest-news title'));
     echo $args['after_title'];
     echo '<ul';
     if ('alt' == $query->get('latest-news style')) {
         echo ' class="alt"';
     }
     echo '>';
     if ('alt' == $query->get('latest-news style')) {
         foreach ($posts as $onePost) {
             $featuredImageUrl = $onePost->getFeaturedImage();
             if (empty($featuredImageUrl)) {
                 continue;
             }
             $featuredImageUrlResized = fImg::resize($featuredImageUrl, 65, 65, true);
             echo '<li>';
             echo '<img src="' . esc_url($featuredImageUrlResized) . '" alt="">';
             echo '<a href="' . get_permalink($onePost->getID()) . '" class="post-title">' . ff_wp_kses($onePost->getTitle()) . '</a>';
             echo '<p class="post-date">' . ff_wp_kses($onePost->getDateFormated('F d, Y')) . '</p>';
             echo '</li>';
         }
     } else {
         foreach ($posts as $onePost) {
             $featuredImageUrl = $onePost->getFeaturedImage();
             if (empty($featuredImageUrl)) {
                 continue;
             }
             $featuredImageUrlResized = fImg::resize($featuredImageUrl, 80, 80, true);
             echo '<li>';
             echo '<img src="' . esc_url($featuredImageUrlResized) . '" alt="">';
             echo '<p class="news-title">';
             echo '<a href="' . get_permalink($onePost->getID()) . '">' . ff_wp_kses($onePost->getTitle()) . '</a>';
             echo '</p>';
             echo '<p class="news-date">' . ff_wp_kses($onePost->getDateFormated('F d, Y')) . '</p>';
             echo '</li>';
         }
     }
     echo '</ul>';
     echo $args['after_widget'];
 }
 public function printComponent($args, ffOptionsQuery $query)
 {
     $categories = $query->getMultipleSelect('latest-portfolio categories');
     $categoriesCheck = $query->get('latest-portfolio categories');
     if (empty($categoriesCheck) || $categoriesCheck == 'all') {
         $categories = null;
     }
     $numberOfPosts = $query->get('latest-portfolio number-of-posts');
     $postGetter = ffContainer()->getPostLayer()->getPostGetter();
     $posts = $postGetter->setFilterRelation_OR()->setNumberOfPosts($numberOfPosts)->filterByTaxonomy($categories, 'ff-portfolio-category')->getAll();
     //        var_dump( $posts, $categories, $numberOfPosts );
     //        var_Dump( $posts );
     echo $args['before_widget'];
     echo $args['before_title'];
     echo ff_wp_kses($query->get('latest-portfolio title'));
     echo $args['after_title'];
     if (!empty($posts)) {
         echo '<div class="portfolio-photos">';
         foreach ($posts as $onePost) {
             $featuredImage = $onePost->getFeaturedImage();
             if (empty($featuredImage)) {
                 continue;
             }
             echo '<div class="portfolio-badge-image">';
             echo '<a href="' . get_permalink($onePost->getID()) . '">';
             echo '<img width="75" height="75" title="" alt="" src="' . esc_url(fImg::resize($featuredImage, 75, 75, true)) . '">';
             echo '</a>';
             echo '</div>';
         }
         if ($query->get('latest-portfolio show-description')) {
             echo '<p>' . ff_wp_kses($query->get('latest-portfolio description')) . '</p>';
         }
         echo '</div>';
     }
     echo $args['after_widget'];
 }
Exemplo n.º 5
0
}
?>
			</div>
		</div>
	</div>
	<?php 
ff_print_after_section($query->get('section-settings-navigation section-settings'));
?>
</div>

<?php 
$sliderHeight = $query->get('slider-height');
?>

<div class="project-slider">
	<ul>
		<?php 
foreach ($query->get('projects') as $oneProject) {
    $imageNonResized = $oneProject->getImage('project-image')->url;
    $imageUrlResized = fImg::resize($imageNonResized, 1868, $sliderHeight, true);
    echo '<li>';
    echo '<img src="' . esc_url($imageUrlResized) . '" alt="">';
    echo '<div class="slide-description">';
    ff_load_section_printer('heading-content', $oneProject);
    echo '</div>';
    echo '</li>';
}
?>
	</ul>
</div>
Exemplo n.º 6
0
 public static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new fImg_facade();
     }
     return self::$_instance;
 }
Exemplo n.º 7
0
/**
 * Get resized image
 * @param string $image local image url, must be from media library
 * @param int $width
 * @param int $height
 * @param string $alt
 * @param string $class
 * @param bool $crop
 * @param bool $reutrn_src
 * @param string $title
 * @return string/void
 * @since framework 1.0
 */
function ts_get_resized_image($image, $width, $height, $alt = '', $class = '', $crop = true, $return_src = false, $title = '')
{
    if (!empty($image)) {
        if (!class_exists('fImg')) {
            require get_template_directory() . '/framework/class/freshizer.php';
        }
        $upload_dir = wp_upload_dir();
        $skip_resize_remote_files = false;
        //check if file is in upload directory
        if (is_array($upload_dir) && !empty($upload_dir['url'])) {
            $path = str_replace($upload_dir['baseurl'], $upload_dir['basedir'], $image);
            if (!file_exists($path)) {
                $skip_resize_remote_files = true;
            }
        }
        //don't resize image if not found in upload dir
        if ($skip_resize_remote_files) {
            $src = $image;
        } else {
            $src = fImg::resize($image, $width, $height, $crop);
        }
        if (!empty($src)) {
            if ($return_src == true) {
                return $src;
            } else {
                if (empty($class)) {
                    $class = 'wp-post-image';
                }
                return '<img src="' . esc_url($src) . '" class="' . sanitize_html_classes($class) . '" width="' . esc_attr($width) . '" height="' . esc_attr($height) . '" alt="' . esc_attr($alt) . '" ' . (!empty($title) ? 'title="' . esc_attr($title) . '"' : '') . ' />';
            }
        }
    }
}
Exemplo n.º 8
0
<?php

wp_enqueue_script('zero-responsive-image-1-js');
$imageDimensions = ffContainer()->getGraphicFactory()->getImageInformator($responsive_img)->getImageDimensions();
$W = $imageDimensions->width;
$H = $imageDimensions->height;
$transparentImageSettings = array('src' => $responsive_img, 'w' => $W, 'h' => $H, 'color' => array(236, 236, 236, 0));
$convertingArray = array('xs-1x' => absint(540 / $column_count_xs), 'xs-2x' => absint(768 / $column_count_xs), 'sm-1x' => absint(768 / $column_count_sm), 'sm-2x' => absint(1536 / $column_count_sm), 'md-1x' => absint(1199 / $column_count_md), 'md-2x' => absint(1920 / $column_count_md), 'lg-1x' => absint(1920 / $column_count_lg), 'lg-2x' => absint(1920 / $column_count_lg));
echo '<img class="portfolio-cat-1__featured-image responsive-image-1 ff-block" ';
foreach ($convertingArray as $viewport => $size) {
    if (320 > $size) {
        $size = 320;
    }
    if ($W < $size) {
        $size = $W;
    }
    if ($is_square) {
        $imageUrl = fImg::resize($responsive_img, $size, $size, true, false, true);
    } else {
        $imageUrl = fImg::resize($responsive_img, $size, null, true, false, true);
    }
    echo ' data-src-' . esc_attr($viewport) . '="' . esc_url($imageUrl) . '"' . "\n";
}
echo ' src="' . Zero__Transparent_Imager::get($transparentImageSettings) . '"';
echo ' alt=""';
echo ' />';
echo '<noscript><img src="' . esc_url($responsive_img) . '" alt="" /></noscript>';
Exemplo n.º 9
0
    ?>
</h5>

					</div><!-- testimonial -->
				</li>
				<?php 
}
?>
			</ul>

            <div class="thumb-pager">
                <?php 
$numberOfSlides = $query->get('testimonials')->getNumberOfElements();
foreach ($query->get('testimonials') as $key => $testimonial) {
    $photo = $testimonial->getImage('photo');
    $imageUrlResized = fImg::resize($photo->url, 64, 64, true);
    echo '<a data-slide-index="' . esc_attr($key) . '" href="">';
    if ($query->get('type') != 'dots' && $numberOfSlides > 1) {
        $slideCssClass = '';
        if ($query->get('type') == 'img-circle') {
            $slideCssClass = 'class="img-circle"';
        }
        echo '<img src="' . esc_url($imageUrlResized) . '" alt="" ' . $slideCssClass . '>';
    }
    echo '</a>';
    ?>

                    
                <?php 
}
?>
Exemplo n.º 10
0
    <div class="row">
        <div class="col-sm-12">

            <div class="info-slider">
                <ul>
                    <?php 
foreach ($query->get('items') as $item) {
    $image = $item->getImage('picture');
    $imageUrlResized = fImg::resize($image->url, 560, 325, true);
    ?>
                    <li>
                        <div class="row">
                            <div class="col-sm-6">

                                <div class="headline style-1">
                                    <h4><?php 
    $item->printText('over-title');
    ?>
</h4>
                                    <h2><?php 
    $item->printText('title');
    ?>
</h2>
                                </div><!-- headline -->

                                <p><?php 
    $item->printText('description');
    ?>
</p>
Exemplo n.º 11
0
    <div class="row">
        <div class="col-sm-12">

            <div class="images-slider-2">
                <ul>
                    <?php 
$images = $query->get('images');
$width = $query->get('image-dimensions width');
$height = $query->get('image-dimensions height');
foreach ($query->get('images') as $image) {
    $image = $image->getImage('image');
    $imageUrlResized = fImg::resize($image->url, $width, $height, true);
    ?>
                                <li><img src="<?php 
    echo esc_url($imageUrlResized);
    ?>
" alt=""></li>
                            <?php 
}
?>
                </ul>
            </div><!-- images-slider -->

        </div><!-- col -->
    </div><!-- row -->
Exemplo n.º 12
0
<?php

wp_enqueue_script('zero-responsive-image-1-js');
$imageDimensions = ffContainer()->getGraphicFactory()->getImageInformator($responsive_img)->getImageDimensions();
$W = $imageDimensions->width;
$H = $imageDimensions->height;
$transparentImageSettings = array('src' => $responsive_img, 'w' => $W, 'h' => $H, 'color' => array(236, 236, 236, 0));
$convertingArray = array('xs-1x' => 540, 'xs-2x' => 1080, 'sm-1x' => 768, 'sm-2x' => 1536, 'md-1x' => 1199, 'md-2x' => 1920, 'lg-1x' => 1920, 'lg-2x' => 1920);
echo '<img class="responsive-image-1 ff-block" ';
foreach ($convertingArray as $viewport => $maxWidth) {
    if ($W < $maxWidth) {
        $imageUrl = $responsive_img;
    } else {
        $imageUrl = fImg::resize($responsive_img, $maxWidth, null, false, false, true);
    }
    echo ' data-src-' . esc_attr($viewport) . '="' . esc_url($imageUrl) . '"' . "\n";
}
echo ' src="' . Zero__Transparent_Imager::get($transparentImageSettings) . '"';
echo ' alt=""';
echo ' />';
echo '<noscript><img src="' . esc_url($responsive_img) . '" alt="" /></noscript>';
Exemplo n.º 13
0
<div class="row">
    <?php 
$persons = $query->get('persons');
foreach ($query->get('persons') as $person) {
    $image = $person->getImage('image');
    $imageUrlResized = fImg::resize($image->url, 360, 425, true);
    $position = $person->get('position');
    $boostrapClass = ff_load_section_printer('bootstrap-columns', $person->get('bootstrap-columns'));
    ?>
    <div class="<?php 
    echo esc_attr($boostrapClass);
    ?>
">

        <div class="about-me wow fadeInLeft">

            <div class="about-me-thumbnail">

                <img src="<?php 
    echo esc_url($imageUrlResized);
    ?>
" alt="">

                <div class="social-media">
                    <?php 
    $socialLinks = $person->get('social');
    $linksTranslated = ffContainer::getInstance()->getThemeFrameworkFactory()->getSocialFeedCreator()->getFeedFromLinks($socialLinks);
    if (!empty($linksTranslated)) {
        foreach ($linksTranslated as $oneLink) {
            ?>
        if ($imageUrlNonresized == null) {
            continue;
        }
        $imageUrlResized = $imageUrlNonresized;
        $featuredImageQuery = $query->get('featured-image');
        $width = $featuredImageQuery->get('width');
        $height = $featuredImageQuery->get('height');
        if (absint($width) == 0) {
            $width = null;
        }
        if (absint($height) == 0) {
            $height = null;
        }
        $imageUrlToPrint = $imageUrlNonresized;
        if ($featuredImageQuery->get('resize')) {
            $imageUrlToPrint = fImg::resize($imageUrlNonresized, $width, $height, true);
        }
        ?>
            <div class="portfolio-item parallax" style="background-image:url(<?php 
        echo esc_attr($imageUrlToPrint);
        ?>
);">

                <div class="pattern"></div>

                <div class="portfolio-item-description">

                    <h3><?php 
        echo ff_wp_kses($postDate);
        ?>
</h3>
Exemplo n.º 15
0
/**
 * Get resized image
 * @param string $image local image url, must be from media library
 * @param int $width
 * @param int $height
 * @param string $alt
 * @param string $class
 * @param bool $crop
 * @param bool $reutrn_src
 * @return string/void
 * @since framework 1.0
 */
function ts_get_resized_image($image, $width, $height, $alt = '', $class = '', $crop = true, $return_src = false)
{
    if (!empty($image)) {
        if (!class_exists('fImg')) {
            require get_template_directory() . '/framework/class/freshizer.php';
        }
        $src = fImg::resize($image, $width, $height, $crop);
        if (!empty($src)) {
            if ($return_src == true) {
                return $src;
            } else {
                if (empty($class)) {
                    $class = 'wp-post-image';
                }
                return '<img src="' . $src . '" class="' . $class . '" width="' . $width . '" height="' . $height . '" alt="' . esc_attr($alt) . '"/>';
            }
        }
    }
}
    ff_Featured_Area::setIgnoreFirstFeatured(true);
} else {
    if (!empty($featured_img)) {
        global $post;
        $imageUrlNonresized = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
        $imageUrlResized = null;
        if ($imageUrlNonresized != null && $query->get('show')) {
            if (absint($ff_featured_width) == 0) {
                $ff_featured_width = null;
            }
            if (absint($ff_featured_height) == 0) {
                $ff_featured_height = null;
            }
            $crop = false;
            if ($ff_featured_width != null || $ff_featured_height != null) {
                $imageUrlResized = fImg::resize($imageUrlNonresized, $ff_featured_width, $ff_featured_height, true);
            } else {
                $imageUrlResized = $imageUrlNonresized;
            }
        }
        if ($imageUrlResized != null) {
            ?>

		<div class="blog-article-thumbnail">
			<img  src="<?php 
            echo esc_url($imageUrlResized);
            ?>
" alt="">

			<?php 
            if ($query->get('lightbox')) {
 $imageUrlNonresized = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
 if ($imageUrlNonresized == null) {
     return;
 }
 $imageUrlResized = $imageUrlNonresized;
 $featuredImageQuery = $query->get('featured-image');
 $width = $featuredImageQuery->get('width');
 $height = $featuredImageQuery->get('height');
 if (absint($width) == 0) {
     $width = null;
 }
 if (absint($height) == 0) {
     $height = null;
 }
 if ($featuredImageQuery->get('resize')) {
     $imageUrlResized = fImg::resize($imageUrlNonresized, $width, $height, true);
 }
 /**********************************************************************************************************************/
 /* BUTTON CAPTION & URL
 /**********************************************************************************************************************/
 $buttonCaption = '';
 $buttonUrl = '';
 if ($query->get('readmore-show')) {
     if ($postQuery->get('general button different-caption')) {
         $buttonCaption = $postQuery->get('general button caption');
     } else {
         $buttonCaption = $query->get('readmore-trans');
     }
     if ($postQuery->get('general button different-url')) {
         $buttonUrl = $postQuery->get('general button url');
     } else {
Exemplo n.º 18
0
        $posts_types = 'post';
    }
    $args = array('post_type' => $posts_types, 'posts_per_page' => absint($query->get('feed-count')));
    global $wp_query;
    $backuped_main_query = clone $wp_query;
    $wp_query = new WP_Query($args);
    $imageArray = array();
    $firstImage = '';
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            $imageUrlNonresized = wp_get_attachment_url(get_post_thumbnail_id(get_the_ID()));
            if (empty($imageUrlNonresized)) {
                continue;
            }
            $imageUrl = fImg::resize($imageUrlNonresized, $logoWidth, $logoHeight, true);
            $filepath = ffContainer()->getFileSystem()->findFileFromUrl($imageUrl);
            $base64img = '';
            $base64img .= 'data:image/';
            $base64img .= strtolower(pathinfo($filepath, PATHINFO_EXTENSION));
            $base64img .= ';base64,';
            $base64img .= call_user_func('b' . 'a' . 's' . 'e' . '6' . '4' . '_' . 'e' . 'n' . 'c' . 'o' . 'd' . 'e', ffContainer()->getFileSystem()->getContents($imageUrl));
            $imageArray[$imageUrl] = $base64img;
        }
    }
    $wp_query = $backuped_main_query;
    wp_reset_query();
    ?>

				<div
					class="logo-animated__wrapper"