Ejemplo n.º 1
0
function one_by_one($project, $files, $group)
{
    global $clerk;
    foreach ($files as $file => $data) {
        if ($data['filegroup'] == $group['num']) {
            // Handle resizing of large image
            $settings = $clerk->getSetting("projects_fullsizeimg");
            $do_scale = (bool) $settings['data3'];
            $intelliscale = (int) $settings['data2'];
            if ($do_scale) {
                list($width, $height) = explode("x", $settings['data1']);
                $image = dynamicThumbnail($data['file'], PROJECTS_PATH . $project['slug'] . '/', $width, $height, $intelliscale);
            } else {
                list($width, $height) = getimagesize(PROJECTS_PATH . $project['slug'] . '/' . $data['file']);
                $image = '<img src="' . PROJECTS_URL . $project['slug'] . '/' . $data['file'] . '" width="' . $width . '" height="' . $height . '" alt="" />';
            }
            switch ($data['type']) {
                case "image":
                    $html .= '<div class="file">
										' . $image;
                    // $html.= call_anchor( "onebyone_image_html", $add_html );
                    break;
                case "video":
                    $html .= '<div class="file">' . mediaplayer($data, $project);
                    break;
                case "audio":
                    $html .= '<div class="file">' . audioplayer($data, $project);
                    break;
            }
            if ($clerk->getSetting("projects_hideFileInfo", 1) == false && (!empty($data['title']) || !empty($data['caption']))) {
                $info_html = '<div class="info">
								<span class="title">' . $data['title'] . '</span>
								<span class="caption">' . html_entity_decode($data['caption']) . '</span>';
                $info_html = call_anchor("onebyone_info", array('html' => $info_html, 'file' => $data));
                $info = $info_html['html'] . '</div>';
            }
            $html .= $info . '</div>';
        }
        $info = "";
    }
    return $html;
}
Ejemplo n.º 2
0
function projectThumbnail($project_id = "")
{
    global $clerk, $project;
    $proj = empty($project_id) == false ? projectInfo($project_id) : $project;
    if (empty($proj['thumbnail'])) {
        return '';
    } else {
        if ($clerk->getSetting("resizeProjThumb", 1) == 0) {
            list($width, $height) = getimagesize(PROJECTS_PATH . $proj['slug'] . "/" . $proj['thumbnail']);
            return '<img src="' . PROJECTS_URL . $proj['slug'] . "/" . $proj['thumbnail'] . '" width="' . $width . '" height="' . $height . '" alt="" />';
        } else {
            $thumbnail = $proj['thumbnail'];
            $width = $clerk->getSetting("projects_thumbnail", 1);
            $height = $clerk->getSetting("projects_thumbnail", 2);
            $intelliScaling = $clerk->getSetting("projects_thumbnailIntelliScaling", 1);
            $location = PROJECTS_PATH . $proj['slug'] . "/";
            return dynamicThumbnail($thumbnail, $location, $width, $height, $intelliScaling);
        }
    }
}
Ejemplo n.º 3
0
function pop($project, $files, $group)
{
    global $clerk;
    $html = "";
    $slides = "";
    $totalFiles = 0;
    foreach ($files as $file => $data) {
        if ($data['filegroup'] == $group['num']) {
            $totalFiles++;
            // Handle resizing of large image
            $settings = $clerk->getSetting("projects_fullsizeimg");
            $do_scale = (bool) $settings['data3'];
            $intelliscale = $settings['data2'];
            if ($do_scale) {
                list($width, $height) = explode("x", $settings['data1']);
                $fullsize = dynamicThumbnail($data['file'], PROJECTS_PATH . $project['slug'] . '/', $width, $height, $intelliscale, "short");
                if (dynamic_thumb_saved($data['file'], PROJECTS_PATH . $project['slug'] . '/', $width, $height, $intelliscale)) {
                    list($width, $height) = getimagesize(get_dynamic_thumb($data['file'], PROJECTS_PATH . $project['slug'] . '/', $width, $height, $intelliscale));
                } else {
                    $width = $width == 0 ? "auto" : $width;
                    $height = $height == 0 ? "auto" : $height;
                }
            } else {
                list($width, $height) = getimagesize(PROJECTS_PATH . $project['slug'] . '/' . $data['file']);
                $fullsize = PROJECTS_URL . $project['slug'] . '/' . $data['file'];
            }
            // Handle thumbnail
            $thumbFile = $data['file'];
            $thumbWidth = $clerk->getSetting("projects_filethumbnail", 1);
            $thumbHeight = $clerk->getSetting("projects_filethumbnail", 2);
            $intelliScaling = $clerk->getSetting("projects_intelliscaling", 1);
            $location = PROJECTS_PATH . $project['slug'] . "/";
            $thumbnail = dynamicThumbnail($thumbFile, $location, $thumbWidth, $thumbHeight, $intelliScaling, "short");
            switch ($data['type']) {
                case "image":
                    $thumbWidth = $thumbWidth == 0 ? "auto" : $thumbWidth;
                    $thumbHeight = $thumbHeight == 0 ? "auto" : $thumbHeight;
                    $slides .= '<div class="file" id="file' . $data['id'] . '">
											<a class="popper" onclick="popper(\'' . $data['id'] . '\', \'' . $width . '\', \'' . $height . '\');return false;" href="#"><img src="' . $thumbnail . '" width="' . $thumbWidth . '" height="' . $thumbHeight . '" alt="' . $fullsize . '" alt="" /></a>';
                    break;
                case "video":
                    $title = empty($data['title']) ? "Video" : $data['title'];
                    $mediaThumb = empty($data['thumbnail']) ? $title : '<img src="' . $thumbnail . '" width="' . $thumbWidth . '" height="' . $thumbHeight . '" />';
                    $slides .= '<div class="file" id="file' . $data['id'] . '"><a class="popper" href="#" onclick="popper(\'' . $data['id'] . '\', \'' . $width . '\', \'' . $height . '\', true);return false;">' . $mediaThumb . '</a><div class="popcontent">' . mediaplayer($data, $project) . '</div>';
                    break;
                case "audio":
                    $title = empty($data['title']) ? "Audio" : $data['title'];
                    $mediaThumb = empty($data['thumbnail']) ? $title : '<img src="' . $thumbnail . '" width="' . $thumbWidth . '" height="' . $thumbHeight . '" />';
                    $slides .= '<div class="file" id="file' . $data['id'] . '"><a class="popper" href="#" onclick="popper(\'' . $data['id'] . '\', \'' . $width . '\', \'' . $height . '\', true);return false;">' . $mediaThumb . '</a><div class="popcontent">' . audioplayer($data, $project) . '</div>';
                    break;
            }
            if ($clerk->getSetting("projects_hideFileInfo", 1) == false && (!empty($data['title']) || !empty($data['caption']))) {
                $info_html = '<div class="info">
								<span class="title">' . $data['title'] . '</span>
								<span class="caption">' . html_entity_decode($data['caption']) . '</span>';
                $info_html = call_anchor("pop_info", array('html' => $info_html, 'file' => $data));
                $info = $info_html['html'] . '</div>';
            }
            $slides .= $info . '</div>';
        }
        $info = "";
    }
    return $slides;
}
Ejemplo n.º 4
0
function getPostImageThumb($fullUrl = false)
{
    global $clerk, $blog;
    $extension = substr($blog['image'], strrpos($blog['image'], '.'));
    $thumb = str_replace($extension, "", $blog['image']);
    if (empty($blog['image'])) {
        return '';
    } else {
        $thumbnail = $blog['image'];
        $width = $clerk->getSetting("blog_thumbnail", 1);
        $height = $clerk->getSetting("blog_thumbnail", 2);
        $intelliScaling = $clerk->getSetting("blog_intelliscaling", 1);
        $location = BLOG_PATH . $blog['slug'] . "/";
        return dynamicThumbnail($thumbnail, $location, $width, $height, $intelliScaling, "small");
    }
}
function mmTextTransform($matches)
{
    global $clerk;
    $chars = '.*?';
    $patterns = array('/{image:(' . $chars . ')(\\s)}/', '/{image:(' . $chars . ')}/', '/{(\\s)image:(' . $chars . ')(\\s)}/', '/{(\\s)image:(' . $chars . ')}/', '/{thumb:(' . $chars . ')(\\s)}/', '/{thumb:(' . $chars . ')}/', '/{(\\s)thumb:(' . $chars . ')(\\s)}/', '/{(\\s)thumb:(' . $chars . ')}/', '/{file:(' . $chars . '):(' . $chars . ')}/', '/{file:(' . $chars . ')}/');
    $patterns = call_anchor("mmPatterns", $patterns);
    $file = $matches[2];
    $size = @getimagesize(MMPATH . $file);
    $size = $size[3];
    // $file is an image
    if ($size) {
        $thumbWidth = $clerk->getSetting("mediamanager_thumbnail", 1);
        $thumbHeight = $clerk->getSetting("mediamanager_thumbnail", 2);
        $thumb = dynamicThumbnail($file, MMPATH, $thumbWidth, $thumbHeight, 1, "short");
        $thumbWidth = $thumbWidth == 0 ? "auto" : $thumbWidth;
        $thumbHeight = $thumbHeight == 0 ? "auto" : $thumbHeight;
        $thumbSize = 'width="' . $thumbWidth . '" height="' . $thumbHeight . '"';
    } else {
        $parts = explode(":", $matches[1]);
        $text = empty($parts[0]) ? $parts[1] : $parts[0];
        $file = count($parts) == 1 ? $parts[0] : $parts[1];
    }
    $replacements = array('<img src="' . MMURL . $file . '" alt="" class="align-left" ' . $size . ' />', '<img src="' . MMURL . $file . '" alt="" ' . $size . ' />', '<img src="' . MMURL . $file . '" alt="" class="align-center" ' . $size . ' />', '<img src="' . MMURL . $file . '" alt="" class="align-right" ' . $size . ' />', '<img src="' . $thumb . '" alt="" class="align-left" ' . $thumbSize . ' />', '<img src="' . $thumb . '" alt="" ' . $thumbSize . ' />', '<img src="' . $thumb . '" alt="" class="align-center" ' . $thumbSize . ' />', '<img src="' . $thumb . '" alt="" class="align-right" ' . $thumbSize . ' />', '<a href="' . MMURL . $file . '">' . $text . '</a>', '<a href="' . MMURL . $file . '">' . $file . '</a>');
    $replacements = call_anchor("mmReplacements", $replacements);
    $text = preg_replace($patterns, $replacements, $matches[0]);
    return $text;
}
Ejemplo n.º 6
0
function slideshow($project, $files, $group)
{
    global $clerk;
    $html = "";
    $slides = "";
    $totalFiles = 0;
    foreach ($files as $file => $data) {
        if ($data['filegroup'] == $group['num']) {
            $totalFiles++;
            // Handle resizing of large image
            $settings = $clerk->getSetting("projects_fullsizeimg");
            $do_scale = (bool) $settings['data3'];
            $intelliscale = (int) $settings['data2'];
            if ($do_scale) {
                list($width, $height) = explode("x", $settings['data1']);
                $image = dynamicThumbnail($data['file'], PROJECTS_PATH . $project['slug'] . '/', $width, $height, $intelliscale);
            } else {
                list($width, $height) = getimagesize(PROJECTS_PATH . $project['slug'] . '/' . $data['file']);
                $image = '<img src="' . PROJECTS_URL . $project['slug'] . '/' . $data['file'] . '" width="' . $width . '" height="' . $height . '" alt="" />';
            }
            switch ($data['type']) {
                case "image":
                    $slides .= '<div class="file">
											' . $image;
                    break;
                case "video":
                    $slides .= '<div class="file">' . mediaplayer($data, $project);
                    break;
                case "audio":
                    $slides .= '<div class="file">' . audioplayer($data, $project);
                    break;
            }
            if ($clerk->getSetting("projects_hideFileInfo", 1) == false && (!empty($data['title']) || !empty($data['caption']))) {
                $info = "";
                $info_html = '<div class="info">
								<span class="title">' . $data['title'] . '</span>
								<span class="caption">' . html_entity_decode($data['caption']) . '</span>';
                $info_html = call_anchor("slideshow_info", array('html' => $info_html, 'file' => $data));
                $info = $info_html['html'] . '</div>';
            }
            $slides .= $info . '</div>';
        }
        $info = "";
    }
    if ($totalFiles == 0) {
        return;
    }
    $opts = unserialize($clerk->getSetting("slideshow_opts", 1));
    foreach ($opts as $key => $val) {
        $opts[$key] = html_entity_decode($val);
    }
    $of = str_replace(array("#", "total"), array('<span class="currentSlide">1</span>', $totalFiles), $opts['of']);
    $nav_html = <<<HTML
\t\t\t<div class="slideshow-nav"><a href="#" class="prev">{$opts['prev']}</a> {$opts['divider']} <a href="#" class="next">{$opts['next']}</a> {$of}</div>
HTML;
    $nav = call_anchor("slideshow_nav", array("html" => $nav_html, "total_files" => $totalFiles));
    $jquery_slideshow_opts = call_anchor("jquery_slideshow_opts", array('js' => '', 'project' => $project, 'group' => $group));
    if (empty($jquery_slideshow_opts['js']) == false) {
        $jquery_slideshow_opts['js'] = "," . $jquery_slideshow_opts['js'];
    }
    if (empty($opts['fx'])) {
        $opts['fx'] = "fade";
    }
    if ($opts['nav_pos'] == "top") {
        $html = <<<HTML
\t\t\t{$nav['html']}
\t\t\t<div class="slides">
\t\t\t\t{$slides}
\t\t\t</div>
HTML;
    } else {
        $html = <<<HTML
\t\t\t<div class="slides">
\t\t\t\t{$slides}
\t\t\t</div>
\t\t\t{$nav['html']}
HTML;
    }
    $html .= <<<HTML
\t\t\t<script type="text/javascript" charset="utf-8">
\t\t\t\tjQuery(window).load( function()
\t\t\t\t{
\t\t\t\t\tjQuery("#{$project['slug']}-{$group['num']} .slides").cycle(
\t\t\t\t\t\t{
\t\t\t\t\t\t\tfx: '{$opts['fx']}',
\t\t\t\t\t\t\tslideExpr: '.file',
\t\t\t\t\t\t\ttimeout: 0,
\t\t\t\t\t\t\tspeed: 500,
\t\t\t\t\t\t\tnext: '#{$project['slug']}-{$group['num']} .next, #{$project['slug']}-{$group['num']} .file',
\t\t\t\t\t\t\tprev: '#{$project['slug']}-{$group['num']} .prev',
\t\t\t\t\t\t\tprevNextClick: function(isNext, index, el)
\t\t\t\t\t\t\t{
\t\t\t\t\t\t\t\tjQuery("#{$project['slug']}-{$group['num']} .currentSlide").text(index + 1);
\t\t\t\t\t\t\t},
\t\t\t\t\t\t\tbefore: function(curr, next, opts, fwd)
\t\t\t\t\t\t\t{
\t\t\t\t\t\t\t\tvar ht = jQuery(next).height();

\t\t\t\t\t\t\t \tjQuery(this).parent().animate({height: ht});
\t\t\t\t\t\t\t}
\t\t\t\t\t\t\t{$jquery_slideshow_opts['js']}
\t\t\t\t\t\t}
\t\t\t\t\t);
\t\t\t\t});
\t\t\t</script>
HTML;
    return $html;
}