/** * Save Gallery Content * */ public 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 = \gp\tool::ThumbnailPath($image); $caption = $_POST['captions'][$i]; \gp\tool\Files::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 */ public static function ShowFile_Gallery($dir_piece, $file) { global $langmessage, $dataDir; if (!self::IsImg($file)) { return; } //for gallery editing $rel_path = '/data/_uploaded' . $dir_piece . '/' . $file; $id = self::ImageId($rel_path); $file_url = \gp\tool::GetDir($rel_path); $full_path = $dataDir . $rel_path; //thumbnail $thumb_url = \gp\tool::ThumbnailPath($file_url); $thumb = ' <img src="' . $thumb_url . '" alt="" />'; //get size $size = ''; $size_a = getimagesize($full_path); if (is_array($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>' . \gp\tool::Link('Admin/Uploaded' . $dir_piece, '', $query_string, array('class' => 'delete fa fa-minus-circle gpconfirm', 'data-cmd' => 'gpajax', 'title' => $langmessage['delete_confirm']), 'delete') . '</span>'; }