Ejemplo n.º 1
0
<?php 
$dir = JPath::clean(JPATH_ROOT . '/images/' . $options->get('dir'));
// Allowed filetypes
$allowedExtensions = array('jpg', 'png', 'gif');
// Also allow filetypes in uppercase
$allowedExtensions = array_merge($allowedExtensions, array_map('strtoupper', $allowedExtensions));
// Build the filter. Will return something like: "jpg|png|JPG|PNG|gif|GIF"
$filter = implode('|', $allowedExtensions);
$filter = "^.*\\.(" . implode('|', $allowedExtensions) . ")\$";
$files = JFolder::files($dir, $filter, false, true);
if (is_array($files)) {
    foreach ($files as $key => $image) {
        $image = JPath::clean($image);
        $images[$key]['src'] = ZtShortcodesPath::getInstance()->toUrl(ZtShortcodesHelperImage::getThumbnail($image, $options->get('width', 600), $options->get('height', 600), 'resized_'));
        $images[$key]['thumbnail'] = ZtShortcodesPath::getInstance()->toUrl(ZtShortcodesHelperImage::getThumbnail($image, $options->get('thumb-width', 300), $options->get('thumb-height', 300), 'thumb_'));
    }
}
$style = '';
if ($options->get('thumb-width') != '') {
    $style .= 'width: ' . $options->get('thumb-width') . 'px';
} elseif ($options->get('thumb-height') != '') {
    $style .= 'height: ' . $options->get('thumb-height') . 'px';
}
?>

<div class="zt-gallery zt-gallery-default clearfix">
    <?php 
if (!empty($images)) {
    ?>
        <?php 
Ejemplo n.º 2
0
 */
defined('_JEXEC') or die('Restricted access');
$dir = JPath::clean(JPATH_ROOT . '/images/' . $attributes->get('dir'));
// Allowed filetypes
$allowedExtensions = array('jpg', 'png', 'gif');
// Also allow filetypes in uppercase
$allowedExtensions = array_merge($allowedExtensions, array_map('strtoupper', $allowedExtensions));
// Build the filter. Will return something like: "jpg|png|JPG|PNG|gif|GIF"
$filter = implode('|', $allowedExtensions);
$filter = "^.*\\.(" . implode('|', $allowedExtensions) . ")\$";
$files = JFolder::files($dir, $filter, false, true);
if (is_array($files)) {
    foreach ($files as $key => $image) {
        $image = JPath::clean($image);
        $images[$key]['src'] = ZtShortcodesPath::getInstance()->toUrl(ZtShortcodesHelperImage::getThumbnail($image, $attributes->get('width', 600), $attributes->get('height', 600), 'resized_'));
        $images[$key]['thumbnail'] = ZtShortcodesPath::getInstance()->toUrl(ZtShortcodesHelperImage::getThumbnail($image, $attributes->get('thumbWidth', 300), $attributes->get('thumbHeight', 300), 'thumb_'));
    }
}
?>

<div class="zt-gallery zt-gallery-default clearfix">
    <?php 
if (!empty($images)) {
    ?>
    <?php 
    foreach ($images as $image) {
        ?>
            <a href="<?php 
        echo $image['src'];
        ?>
" class="ztshortcodes-gallery group1">