/** * Get The Image * */ public function Child($title) { global $dirPrefix; $content = $this->TitleContent($title); $img_pos = strpos($content, '<img'); if ($img_pos === false) { return; } $src_pos = strpos($content, 'src=', $img_pos); if ($src_pos === false) { return; } $src = substr($content, $src_pos + 4); $quote = $src[0]; if ($quote != '"' && $quote != "'") { return; } $src_pos = strpos($src, $quote, 1); $src = substr($src, 1, $src_pos - 1); // check for resized image, get original source if img is resized if (strpos($src, 'image.php') !== false && strpos($src, 'img=') !== false) { $src = $dirPrefix . '/data/_uploaded/' . urldecode(substr($src, strpos($src, 'img=') + 4)); } $thumb_path = common::ThumbnailPath($src); echo '<li>'; echo '<img src="' . $thumb_path . '"/>'; $label = common::GetLabel($title); echo common::Link($title, $label); echo '</li>'; }
static function GenerateContent($section_data) { global $dataDir; $section_data += array('images' => array(), 'height' => '400'); $id = 'carousel_' . time(); $images = ''; $indicators = ''; $j = 0; foreach ($section_data['images'] as $i => $img) { if (empty($img)) { continue; } $caption = trim($section_data['captions'][$i]); $class = ''; if ($j == 0) { $class = 'active'; } //images $caption_class = ''; if (empty($caption)) { $caption_class = 'no_caption'; } $images .= '<div class="item ' . $class . '">' . '<img src="' . common::GetDir('/include/imgs/blank.gif') . '" style="background-image:url(' . $img . ')" alt="">' . '<div class="caption carousel-caption ' . $caption_class . '">' . $caption . '</div>' . '</div>'; //indicators $thumb_path = common::ThumbnailPath($img); $indicators .= '<li data-target="#' . $id . '" data-slide-to="' . $j . '" class="' . $class . '">' . '<a href="' . $img . '">' . '<img src="' . $thumb_path . '" alt="">' . '</a>' . '</li>'; $j++; } ob_start(); $class = 'gp_twitter_carousel carousel slide'; if (!$section_data['auto_start']) { $class .= ' start_paused'; } $attr = ' data-speed="5000"'; if (isset($section_data['interval_speed']) && is_numeric($section_data['interval_speed'])) { $attr = ' data-speed="' . $section_data['interval_speed'] . '"'; } echo '<div id="' . $id . '" class="' . $class . '"' . $attr . '>'; echo '<div style="padding-bottom:' . $section_data['height'] . '">'; // Indicators echo '<ol class="carousel-indicators">'; echo $indicators; echo '</ol>'; // Carousel items echo '<div class="carousel-inner">'; echo $images; echo '</div>'; // Carousel nav echo '<a class="carousel-control left" data-target="#' . $id . '" data-slide="prev">‹</a>'; echo '<a class="carousel-control right" data-target="#' . $id . '" data-slide="next">›</a>'; echo '<span class="gp_blank_img" data-src="' . common::GetDir('/include/imgs/blank.gif') . '" style="display:none"></span>'; echo '</div></div>'; return ob_get_clean(); }
static function GenerateContent($section_data) { $section_data += array('images' => array()); $icons = $first_image = $first_caption = ''; foreach ($section_data['images'] as $i => $img) { $caption =& $section_data['captions'][$i]; $hash = $size_a = false; $attr = ''; if (empty($first_image)) { $hash = 1; $first_caption = $caption; $first_image = '<a class="slideshowb_img_' . $hash . '" data-cmd="slideshowb_next" href="' . $img . '">'; $first_image .= '<img src="' . $img . '" alt="">'; $first_image .= '</a>'; } if ($hash) { $attr = ' data-hash="' . $hash . '" class="slideshowb_icon_' . $hash . '"'; } $thumb_path = common::ThumbnailPath($img); $icons .= '<li>'; $icons .= '<a data-cmd="slideshowb_img" href="' . $img . '"' . $attr . ' title="' . htmlspecialchars($caption) . '">'; $icons .= '<img alt="" src="' . $thumb_path . '">'; $icons .= '</a>'; $icons .= '<div class="caption">' . $caption . '</div>'; $icons .= '</li>'; } ob_start(); $class = 'slideshowb_wrap'; if ($section_data['auto_start']) { $class .= ' start'; } $attr = ' data-speed="5000"'; if (isset($section_data['interval_speed']) && is_numeric($section_data['interval_speed'])) { $attr = ' data-speed="' . $section_data['interval_speed'] . '"'; } echo '<div class="' . $class . '"' . $attr . '>'; echo '<div class="slideshowb_images">'; echo $first_image; echo '</div>'; echo '<div class="slideshowb_caption prov_caption">'; echo $first_caption . ' '; echo '</div>'; echo '<div class="slideshowb_icons prov_icons"><span></span><ul>'; echo $icons; echo '</ul></div>'; echo '</div>'; return ob_get_clean(); }
/** * Get The Image * */ function Child($title) { global $dirPrefix; $file = gpFiles::PageFile($title); $file_sections = $file_stats = array(); ob_start(); require $file; ob_get_clean(); if (!is_array($file_sections)) { return; } //get the image $content = section_content::Render($file_sections, $title, $file_stats); $img_pos = strpos($content, '<img'); if ($img_pos === false) { return; } $src_pos = strpos($content, 'src=', $img_pos); if ($src_pos === false) { return; } $src = substr($content, $src_pos + 4); $quote = $src[0]; if ($quote != '"' && $quote != "'") { return; } $src_pos = strpos($src, $quote, 1); $src = substr($src, 1, $src_pos - 1); // check for resized image, get original source if img is resized if (strpos($src, 'image.php') !== false && strpos($src, 'img=') !== false) { $src = $dirPrefix . '/data/_uploaded/' . urldecode(substr($src, strpos($src, 'img=') + 4)); } $thumb_path = common::ThumbnailPath($src); $img_pos2 = strpos($content, '>', $img_pos); $img = substr($content, $img_pos, $img_pos2 - $img_pos + 1); echo '<li>'; echo '<img src="' . $thumb_path . '"/>'; //echo $img; $label = common::GetLabel($title); echo common::Link($title, $label); echo '</li>'; }
static function FromPost() { //each image $indicators = $first_image = ''; foreach ($_POST['images'] as $i => $img) { if (empty($img)) { continue; } $caption = trim($_POST['captions'][$i]); if (empty($first_image)) { $first_image = '<a href="#" name="gp_slideshow_next" class="slideshow_slide first_image" title="' . htmlspecialchars($caption) . '">' . '<img src="' . $img . '" alt="' . htmlspecialchars($caption) . '" />' . '</a>'; } //indicators $thumb_path = common::ThumbnailPath($img); $indicators .= '<li>' . '<a data-cmd="gp_slideshow" href="' . $img . '" title="' . htmlspecialchars($caption) . '" class="">' . '<img alt="" src="' . $thumb_path . '"></a>' . '<span class="caption" style="display:none">' . htmlspecialchars($caption) . '</span>' . '</li>'; } ob_start(); $class = 'slideshow_area'; if ($_POST['auto_start'] == 'true') { $class .= ' start'; } $attr = ' data-speed="1000"'; if (isset($_POST['interval_speed']) && is_numeric($_POST['interval_speed'])) { $attr = ' data-speed="' . $_POST['interval_speed'] . '"'; } echo '<div class="' . $class . '"' . $attr . '>'; echo '<div class="gp_nosave">'; echo '<div class="slideshow-container loaded">'; echo '<div class="gp_slide_cntrls"><span>'; echo '<a href="#" name="gp_slideshow_prev" class="gp_slide_prev" title="Previous"></a>'; echo '<a href="#" name="gp_slideshow_play" class="gp_slide_play_pause" title="Play / Pause"></a>'; echo '<a href="#" name="gp_slideshow_next" class="gp_slide_next" title="Next"></a>'; echo '</span></div>'; echo '<div class="loader"></div>'; echo $first_image; echo '</div>'; echo '<div class="caption-container"></div>'; echo '</div>'; echo '<div class="gp_slide_thumbs">'; echo '<ul class="gp_slideshow">'; echo $indicators; echo '</ul>'; echo '</div>'; echo '</div>'; return ob_get_clean(); }
/** * Get the fist image from the blog post * */ public function GetImageFromPost($item) { $img_pos = strpos($item, '<img'); if ($img_pos === false) { return; } $src_pos = strpos($item, 'src=', $img_pos); if ($src_pos === false) { return; } $src = substr($item, $src_pos + 4); $quote = $src[0]; if ($quote != '"' && $quote != "'") { return; } $src_pos = strpos($src, $quote, 1); $src = substr($src, 1, $src_pos - 1); // check for resized image, get original source if img is resized if (strpos($src, 'image.php') !== false && strpos($src, 'img=') !== false) { $src = $dirPrefix . '/data/_uploaded/' . urldecode(substr($src, strpos($src, 'img=') + 4)); } $thumb_path = common::ThumbnailPath($src); //make it an absolute path if (isset($_SERVER['HTTP_HOST'])) { $server = $_SERVER['HTTP_HOST']; } else { $server = $_SERVER['SERVER_NAME']; } $thumb_path = '//' . $server . $thumb_path; echo '<img class="img-thumbnail" src="' . $thumb_path . '"/>'; }
/** * Save Gallery Content * */ static function SectionFromPost_Gallery(&$section) { if (empty($_POST['images'])) { $section['content'] = '<ul class="gp_gallery"><li class="gp_to_remove"></li></ul>'; return; } ob_start(); echo '<ul class="gp_gallery">'; foreach ($_POST['images'] as $i => $image) { $thumb_path = common::ThumbnailPath($image); $caption = $_POST['captions'][$i]; gpFiles::cleanText($caption); echo '<li>'; echo '<a class="gallery_gallery" title="' . htmlspecialchars($caption) . '" data-arg="gallery_gallery" href="' . $image . '" data-cmd="gallery">'; echo '<img src="' . $thumb_path . '" alt="" /></a>'; echo '<div class="caption">'; echo $caption; echo '</div>'; echo '</li>'; } echo '</ul>'; $section['content'] = ob_get_clean(); $section['images'] = $_POST['images']; $section['captions'] = $_POST['captions']; }
/** * @static */ static function ShowFile_Gallery($dir_piece, $file) { global $langmessage, $dataDir; if (!admin_uploaded::IsImg($file)) { return false; } //for gallery editing $rel_path = '/data/_uploaded' . $dir_piece . '/' . $file; $id = self::ImageId($rel_path); $file_url = common::GetDir($rel_path); $full_path = $dataDir . $rel_path; //thumbnail $thumb_url = common::ThumbnailPath($file_url); $thumb = ' <img src="' . $thumb_url . '" alt="" />'; //get size $size = ''; $size_a = getimagesize($full_path); if ($size_a) { $size = ' data-width="' . $size_a[0] . '" data-height="' . $size_a[1] . '"'; } $query_string = 'file_cmd=delete&show=inline&file=' . urlencode($file); return '<span class="expand_child" id="' . $id . '">' . '<a href="' . $file_url . '" data-cmd="gp_gallery_add" ' . $size . '>' . $thumb . '</a>' . common::Link('Admin_Uploaded' . $dir_piece, '', $query_string, array('class' => 'delete gpconfirm', 'data-cmd' => 'gpajax', 'title' => $langmessage['delete_confirm']), 'delete') . '</span>'; }