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; }
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; }
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; }