Example #1
0
 function hg_thumb_link($atts, $content = null)
 {
     //[thumb_link type="" width="" height="" src="" class="" style="" url=""]
     // type = thumb // gallery
     extract(shortcode_atts(array("width" => '100', "height" => '75', "src" => '', "style" => '', "class" => '', "url" => '', "type" => 'thumb'), $atts));
     $href = $url ? $url : $src;
     if ($type == 'gallery') {
         $x = $GLOBALS['thumb_count'];
         $GLOBALS['thumb'][$x] = array('href' => $href, 'src' => $src, 'style' => $style, 'class' => $class);
         $GLOBALS['thumb_count']++;
     } else {
         $thumb = JURI::base(true) . '/cache/' . HgShortcodesHelper::createThumb($src, $width, $height);
         return '<a href="' . $href . '" ' . ($class ? 'class="' . $class . '"' : '') . ' ' . ($style ? 'style="' . $style . '"' : '') . ' data-rel="prettyPhoto"><img src="' . $thumb . '" class="shadow" /></a>';
     }
 }
Example #2
0
function hg_simpleGallery($atts, $content = null)
{
    // [simple_gallery folder="" width="" height="" class="" resize="" scale=""]
    extract(shortcode_atts(array("folder" => '', "width" => 100, "height" => 100, "class" => '', "imgclass" => 'thumbnail', "resize" => 1, "scale" => 2), $atts));
    $caching_folder = 'simplegallery_shc';
    $html = array();
    $html[] = '<div class="simple_gallery ' . $class . '">';
    $html[] = '<ul class="gallery">';
    if (!is_dir($folder)) {
        $folder = JPATH_ROOT . '/' . $folder;
    }
    // Get a list of files in the search path with the given filter.
    $filter = '\\.png$|\\.gif$|\\.jpg$';
    $files = JFolder::files($folder, $filter);
    // Build the options list from the list of files.
    if (is_array($files)) {
        foreach ($files as $file) {
            $stripext = JFile::stripExt($file);
            $cachedResizedThumbnail = $resize ? JURI::base(true) . '/cache/' . $caching_folder . '/' . HgShortcodesHelper::createThumb($folder . $file, $width, $height, $scale, $caching_folder) : $folder . $file;
            $html[] = '<li><a href="' . $folder . $file . '" data-lightbox="image" class="thumbnail"><img src="' . $cachedResizedThumbnail . '" alt="' . $stripext . '" class="img-responsive "></a></li>';
        }
    }
    $html[] = '</ul>';
    $html[] = '</div>';
    return implode("\n", $html);
}