function enl_main($html) { global $thisplugin, $thumb_list, $ENLARGEITSET, $CONFIG; // enabled for current user type? if (GALLERY_ADMIN_MODE && !$ENLARGEITSET['enl_adminmode']) { return $html; } if (USER_ID && !$ENLARGEITSET['enl_registeredmode']) { return $html; } if (!USER_ID && !$ENLARGEITSET['enl_guestmode']) { return $html; } // get search string depending on thumb_use setting and SEF switch ($CONFIG['thumb_use']) { case "wd": if (!$ENLARGEITSET['enl_sefmode']) { $ausdruck = "#<!-- BEGIN enlargeit -->\\s*<a\\s*onclick=\"\"\\s*href=\"displayimage.php\\?(.*)\">\\s*<img\\s*src=\"(.*?)" . $CONFIG['thumb_pfx'] . "(.*?)\"\\s*.*\\s*width=\"(.*)\"\\s*border=\".*\"\\s*.*\\s*alt=\"(.*?)\"\\s*title=\".*\n.*\n.*\n.*?\"\\s*/><br /></a><!-- END enlargeit -->#i"; } else { $ausdruck = "#<!-- BEGIN enlargeit -->\\s*<a\\s*onclick=\"\"\\s*href=\"displayimage-(.*)\\.html\">\\s*<img\\s*src=\"(.*?)" . $CONFIG['thumb_pfx'] . "(.*?)\"\\s*.*\\s*width=\"(.*)\"\\s*border=\".*\"\\s*.*\\s*alt=\"(.*?)\"\\s*title=\".*\n.*\n.*\n.*?\"\\s*/><br /></a><!-- END enlargeit -->#i"; } break; case "ht": if (!$ENLARGEITSET['enl_sefmode']) { $ausdruck = "#<!-- BEGIN enlargeit -->\\s*<a\\s*onclick=\"\"\\s*href=\"displayimage.php\\?(.*)\">\\s*<img\\s*src=\"(.*?)" . $CONFIG['thumb_pfx'] . "(.*?)\"\\s*.*\\s*height=\"(.*)\"\\s*border=\".*\"\\s*.*\\s*alt=\"(.*?)\"\\s*title=\".*\n.*\n.*\n.*?\"\\s*/><br /></a><!-- END enlargeit -->#i"; } else { $ausdruck = "#<!-- BEGIN enlargeit -->\\s*<a\\s*onclick=\"\"\\s*href=\"displayimage-(.*)\\.html\">\\s*<img\\s*src=\"(.*?)" . $CONFIG['thumb_pfx'] . "(.*?)\"\\s*.*\\s*height=\"(.*)\"\\s*border=\".*\"\\s*.*\\s*alt=\"(.*?)\"\\s*title=\".*\n.*\n.*\n.*?\"\\s*/><br /></a><!-- END enlargeit -->#i"; } break; default: if (!$ENLARGEITSET['enl_sefmode']) { $ausdruck = "#<!-- BEGIN enlargeit -->\\s*<a\\s*onclick=\"\"\\s*href=\"displayimage.php\\?(.*)\">\\s*<img\\s*src=\"(.*?)" . $CONFIG['thumb_pfx'] . "(.*?)\"\\s*.*\\s*width=\"(.*)\"\\s*height=\"(.*)\"\\s*border=\".*\"\\s*.*\\s*alt=\"(.*?)\"\\s*title=\".*\n.*\n.*\n.*?\"\\s*/><br /></a><!-- END enlargeit -->#i"; } else { $ausdruck = "#<!-- BEGIN enlargeit -->\\s*<a\\s*onclick=\"\"\\s*href=\"displayimage-(.*)\\.html\">\\s*<img\\s*src=\"(.*?)" . $CONFIG['thumb_pfx'] . "(.*?)\"\\s*.*\\s*width=\"(.*)\"\\s*height=\"(.*)\"\\s*border=\".*\"\\s*.*\\s*alt=\"(.*?)\"\\s*title=\".*\n.*\n.*\n.*?\"\\s*/><br /></a><!-- END enlargeit -->#i"; } } // get album, cat and pos for each thumb preg_match_all($ausdruck, $html, $treffer, PREG_SET_ORDER); $i = 0; foreach ($treffer as $match) { $i++; //File Type detection - EnlargeIt! is for images and SWF files only switch ($CONFIG['thumb_use']) { case "wd": $enl_filetype = explode(".", $match[5]); if (substr($match[5], 0, 8) == 'youtube_') { $enl_filetype[1] = 'ytb'; } if (substr($match[5], -5) == '.divx') { $enl_filetype[1] = 'dvx'; } if (substr($match[5], -4) == '.flv') { $enl_filetype[1] = 'flv'; } break; case "ht": $enl_filetype = explode(".", $match[5]); if (substr($match[5], 0, 8) == 'youtube_') { $enl_filetype[1] = 'ytb'; } if (substr($match[5], -5) == '.divx') { $enl_filetype[1] = 'dvx'; } if (substr($match[5], -4) == '.flv') { $enl_filetype[1] = 'flv'; } break; default: $enl_filetype = explode(".", $match[6]); if (substr($match[6], 0, 8) == 'youtube_') { $enl_filetype[1] = 'ytb'; } if (substr($match[6], -5) == '.divx') { $enl_filetype[1] = 'dvx'; } if (substr($match[6], -4) == '.flv') { $enl_filetype[1] = 'flv'; } } $enl_filetyplower = strtolower($enl_filetype[1]); if ($enl_filetyplower == 'jpg' || $enl_filetyplower == 'jpeg' || $enl_filetyplower == 'jpe' || $enl_filetyplower == 'png' || $enl_filetyplower == 'gif' || $enl_filetyplower == 'bmp' || $enl_filetyplower == 'jpc' || $enl_filetyplower == 'jp2' || $enl_filetyplower == 'jpx' || $enl_filetyplower == 'jb2' || $enl_filetyplower == 'swc' || $enl_filetyplower == 'swf' || $enl_filetyplower == 'ytb' || $enl_filetyplower == 'dvx' || $enl_filetyplower == 'flv') { // get pos, album, cat out of URL if (!$ENLARGEITSET['enl_sefmode']) { preg_match_all("#album=(.+)&cat=(.+)&pos=(.+)#i", $match[1], $enl_gotit); } else { preg_match_all("#(.+?)-(.+?)-(.+)#i", $match[1], $enl_gotit); } if ($enl_gotit[0]) { $album = $enl_gotit[1][0]; $cat = (int) $enl_gotit[2][0]; $pos = (int) $enl_gotit[3][0]; } else { if (!$ENLARGEITSET['enl_sefmode']) { preg_match_all("/album=(.+)&pos=(.+)/", $match[1], $enl_gotittoo); } else { preg_match_all("/(.+?)-(.+)/", $match[1], $enl_gotittoo); } if ($enl_gotittoo[0]) { $album = $enl_gotittoo[1][0]; $cat = 0; $pos = (int) $enl_gotittoo[2][0]; } else { $album = ''; $cat = 0; $pos = 0; } } if (!$album) { $album = ''; } if (!$cat) { $cat = 0; } if (!$pos) { $pos = 0; } // Retrieve data for the current picture if ($pos < 0) { $pid = $pos < 0 ? -$pos : $pid; $result = cpg_db_query("SELECT aid from {$CONFIG['TABLE_PICTURES']} WHERE pid='{$pid}' LIMIT 1"); $row = mysql_fetch_array($result); $album = $row['aid']; $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false); for ($pos = 0; $pic_data[$pos]['pid'] != $pid && $pos < $pic_count; $pos++) { } $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false); $CURRENT_PIC_DATA = $pic_data[0]; } else { $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false); if (count($pic_data) == 0 && $pos >= $pic_count) { $pos = $pic_count - 1; $human_pos = $pos + 1; $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false); } $CURRENT_PIC_DATA = $pic_data[0]; } if (!$ENLARGEITSET['enl_sefmode']) { $neu_str = '<a onclick="return false;" href="displayimage.php?' . $match[1]; } else { $neu_str = '<a onclick="return false;" href="displayimage-' . $match[1] . '.html'; } if ($ENLARGEITSET['enl_pictype'] == 1) { $enl_path = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename']; } else { if ($ENLARGEITSET['enl_pictype'] == 2) { $enl_path = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['normal_pfx'] . $CURRENT_PIC_DATA['filename']; } else { if ($ENLARGEITSET['enl_pictype'] == 0 && is_file($CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['normal_pfx'] . $CURRENT_PIC_DATA['filename'])) { $enl_path = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['normal_pfx'] . $CURRENT_PIC_DATA['filename']; } else { $enl_path = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename']; } } } if ($enl_filetyplower == 'swf') { $enl_swfheight = $CURRENT_PIC_DATA['pheight']; $enl_swfwidth = $CURRENT_PIC_DATA['pwidth']; if ($enl_swfheight == 0) { $enl_swfheight = 400; } if ($enl_swfwidth == 0) { $enl_swfwidth = 400; } $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="swf::' . path2url($enl_path) . '::' . $enl_swfwidth . '::' . $enl_swfheight; } else { if ($enl_filetyplower == 'ytb') { $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="swf::' . str_replace(".jpg", "", str_replace("youtube_", "http://www.youtube.com/v/", $CURRENT_PIC_DATA['filename'])) . '&fs=1&rel=0::480::385'; } else { if ($enl_filetyplower == 'dvx') { $enl_dvxheight = $CURRENT_PIC_DATA['pheight'] + 20; $enl_dvxwidth = $CURRENT_PIC_DATA['pwidth']; if ($enl_dvxheight == 20) { $enl_dvxheight = 212; } if ($enl_dvxwidth == 0) { $enl_dvxwidth = 320; } $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="dvx::' . path2url($enl_path) . '::' . $enl_dvxwidth . '::' . $enl_dvxheight; } else { if ($enl_filetyplower == 'flv') { $enl_flvheight = $CURRENT_PIC_DATA['pheight']; $enl_flvwidth = $CURRENT_PIC_DATA['pwidth']; if ($enl_flvheight == 0) { $enl_flvheight = 410; } if ($enl_flvwidth == 0) { $enl_flvwidth = 500; } if ($ENLARGEITSET['enl_flvplayer'] == 1) { $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="fl2::../../../' . path2url($enl_path) . '::' . $enl_flvwidth . '::' . $enl_flvheight; } else { $neu_str .= '"><img src="' . $match[2] . $CONFIG['thumb_pfx'] . $match[3] . '" longdesc="flv::../../../' . path2url($enl_path) . '::' . $enl_flvwidth . '::' . $enl_flvheight; } } else { $neu_str .= '"><img src="' . $CONFIG['fullpath'] . path2url($CURRENT_PIC_DATA['filepath'] . $CONFIG['thumb_pfx'] . $CURRENT_PIC_DATA['filename']) . '" longdesc="' . path2url($enl_path); } } } } // build the rest of the string depending on thumb_use setting switch ($CONFIG['thumb_use']) { case "ht": $neu_str .= '" border="0" height="' . $match[4] . '" name="' . $CURRENT_PIC_DATA['pid'] . '" class="enlargeimg" onclick="enlarge(this);" alt="' . $CURRENT_PIC_DATA['title'] . '" title="" /><br /></a>'; break; case "wd": $neu_str .= '" border="0" width="' . $match[4] . '" name="' . $CURRENT_PIC_DATA['pid'] . '" class="enlargeimg" onclick="enlarge(this);" alt="' . $CURRENT_PIC_DATA['title'] . '" title="" /><br /></a>'; break; default: $neu_str .= '" border="0" width="' . $match[4] . '" height="' . $match[5] . '" name="' . $CURRENT_PIC_DATA['pid'] . '" class="enlargeimg" onclick="enlarge(this);" alt="' . $CURRENT_PIC_DATA['title'] . '" title="" /><br /></a>'; break; } if ($CURRENT_PIC_DATA['pid'] == $_GET['enlarge']) { $html = str_replace("enl_gifpath = 'plugins/enlargeit/js/'", "enl_openpic = \"enl" . $i . "\";enl_gifpath = 'plugins/enlargeit/js/'", $html); } //$neu_str .= "<script type=\"text/javascript\">enl_openpic = \"enl".$i."\";</script>"; // replace $html = str_replace($match[0], $neu_str, $html); } } return $html; }
/** * get_pic_url() * * Return the url for a picture * * @param array $pic_row * @param string $mode * @param boolean $system_pic * @return string **/ function &get_pic_url(&$pic_row, $mode, $system_pic = false) { global $CONFIG, $THEME_DIR; static $pic_prefix = array(); static $url_prefix = array(); if (!count($pic_prefix)) { $pic_prefix = array('thumb' => $CONFIG['thumb_pfx'], 'normal' => $CONFIG['normal_pfx'], 'orig' => $CONFIG['orig_pfx'], 'fullsize' => ''); $url_prefix = array(0 => $CONFIG['fullpath']); } $mime_content = cpg_get_type($pic_row['filename']); $pic_row = array_merge($pic_row, $mime_content); $filepathname = null; // Code to handle custom thumbnails // If fullsize or normal mode use regular file if ($mime_content['content'] != 'image' && $mode == 'normal') { $mode = 'fullsize'; } elseif ($mime_content['content'] != 'image' && $mode == 'thumb' || $system_pic) { $thumb_extensions = array('.gif', '.png', '.jpg'); // Check for user-level custom thumbnails // Create custom thumb path and erase extension using filename; Erase filename's extension $custom_thumb_path = $url_prefix[$pic_row['url_prefix']] . $pic_row['filepath'] . $pic_prefix[$mode]; $file_base_name = str_replace('.' . $mime_content['extension'], '', basename($pic_row['filename'])); // Check for file-specific thumbs foreach ($thumb_extensions as $extension) { if (file_exists($custom_thumb_path . $file_base_name . $extension)) { $filepathname = $custom_thumb_path . $file_base_name . $extension; break; } } if (!$system_pic) { // Check for extension-specific thumbs if (is_null($filepathname)) { foreach ($thumb_extensions as $extension) { if (file_exists($custom_thumb_path . $mime_content['extension'] . $extension)) { $filepathname = $custom_thumb_path . $mime_content['extension'] . $extension; break; } } } // Check for content-specific thumbs if (is_null($filepathname)) { foreach ($thumb_extensions as $extension) { if (file_exists($custom_thumb_path . $mime_content['content'] . $extension)) { $filepathname = $custom_thumb_path . $mime_content['content'] . $extension; break; } } } } // Use default thumbs if (is_null($filepathname)) { // Check for default theme- and global-level thumbs $thumb_paths[] = $THEME_DIR . 'images/'; // Used for custom theme thumbs $thumb_paths[] = 'images/'; // Default Coppermine thumbs foreach ($thumb_paths as $default_thumb_path) { if (is_dir($default_thumb_path)) { if (!$system_pic) { foreach ($thumb_extensions as $extension) { // Check for extension-specific thumbs if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension)) { $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension; //thumb cropping - if we display a system thumb we calculate the dimension by any and not ex $pic_row['system_icon'] = true; break 2; } } foreach ($thumb_extensions as $extension) { // Check for media-specific thumbs (movie,document,audio) if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension)) { $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension; //thumb cropping $pic_row['system_icon'] = true; break 2; } } } else { // Check for file-specific thumbs for system files foreach ($thumb_extensions as $extension) { if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $file_base_name . $extension)) { $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $file_base_name . $extension; //thumb cropping $pic_row['system_icon'] = true; break 2; } } } } } } $filepathname = path2url($filepathname); } if (is_null($filepathname)) { $filepathname = $url_prefix[$pic_row['url_prefix']] . path2url($pic_row['filepath'] . $pic_prefix[$mode] . $pic_row['filename']); } // Added hack: "&& !isset($pic_row['mode'])" thumb_data filter isn't executed for the fullsize image if ($mode == 'thumb' && !isset($pic_row['mode'])) { $pic_row['url'] = $filepathname; $pic_row['mode'] = $mode; $pic_row = CPGPluginAPI::filter('thumb_data', $pic_row); } elseif ($mode != 'thumb') { $pic_row['url'] = $filepathname; $pic_row['mode'] = $mode; } else { $pic_row['url'] = $filepathname; } return $pic_row['url']; }
<?php function path2url($file, $Protocol = 'http://') { $docRoot = str_replace('/', '\\', $_SERVER['DOCUMENT_ROOT']); return $Protocol . $_SERVER['HTTP_HOST'] . str_replace($docRoot, '', $file); } $dir = __DIR__ . '/gallery'; $files = scandir($dir); $gallery = []; foreach ($files as $file) { $path = $dir . '/' . $file; $fileType = filetype($path); if ($fileType === 'file') { $gallery[] = ["alt" => $file, "extension" => pathinfo($path, PATHINFO_EXTENSION), "thumbnailUrl" => path2url($dir) . '/thumbnails/' . $file, "title" => $file, "type" => filetype($path), "url" => path2url($path)]; } } echo json_encode($gallery);
/** * get_pic_url() * * Return the url for a picture * * @param array $pic_row * @param string $mode * @param boolean $system_pic * @return string **/ function &get_pic_url(&$pic_row, $mode, $system_pic = false) { global $CONFIG, $THEME_DIR; static $pic_prefix = array(); static $url_prefix = array(); if (!count($pic_prefix)) { $pic_prefix = array('thumb' => $CONFIG['thumb_pfx'], 'normal' => $CONFIG['normal_pfx'], 'orig' => $CONFIG['orig_pfx'], 'fullsize' => ''); $url_prefix = array(0 => $CONFIG['fullpath']); } $mime_content = cpg_get_type($pic_row['filename']); // If $mime_content is empty there will be errors, so only perform the array_merge if $mime_content is actually an array if (is_array($mime_content)) { $pic_row = array_merge($pic_row, $mime_content); } $filepathname = null; // Code to handle custom thumbnails // If fullsize or normal mode use regular file if ($mime_content['content'] != 'image' && $mode == 'normal') { $mode = 'fullsize'; } elseif ($mime_content['content'] != 'image' && $mode == 'thumb' || $system_pic) { $thumb_extensions = array('.gif', '.png', '.jpg'); // Check for user-level custom thumbnails // Create custom thumb path and erase extension using filename; Erase filename's extension if (array_key_exists('url_prefix', $pic_row)) { $custom_thumb_path = $url_prefix[$pic_row['url_prefix']]; } else { $custom_thumb_path = ''; } $custom_thumb_path .= $pic_row['filepath'] . (array_key_exists($mode, $pic_prefix) ? $pic_prefix[$mode] : ''); $file_base_name = str_ireplace('.' . $mime_content['extension'], '', basename($pic_row['filename'])); // Check for file-specific thumbs foreach ($thumb_extensions as $extension) { if (file_exists($custom_thumb_path . $file_base_name . $extension)) { $filepathname = $custom_thumb_path . $file_base_name . $extension; break; } } if (!$system_pic) { // Check for extension-specific thumbs if (is_null($filepathname)) { foreach ($thumb_extensions as $extension) { if (file_exists($custom_thumb_path . $mime_content['extension'] . $extension)) { $filepathname = $custom_thumb_path . $mime_content['extension'] . $extension; break; } } } // Check for content-specific thumbs if (is_null($filepathname)) { foreach ($thumb_extensions as $extension) { if (file_exists($custom_thumb_path . $mime_content['content'] . $extension)) { $filepathname = $custom_thumb_path . $mime_content['content'] . $extension; break; } } } } // Use default thumbs if (is_null($filepathname)) { // Check for default theme- and global-level thumbs $thumb_paths[] = $THEME_DIR . 'images/'; // Used for custom theme thumbs $thumb_paths[] = 'images/thumbs/'; // Default Coppermine thumbs foreach ($thumb_paths as $default_thumb_path) { if (is_dir($default_thumb_path)) { if (!$system_pic) { foreach ($thumb_extensions as $extension) { // Check for extension-specific thumbs if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension)) { $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension; //thumb cropping - if we display a system thumb we calculate the dimension by any and not ex $pic_row['system_icon'] = true; break 2; } } foreach ($thumb_extensions as $extension) { // Check for media-specific thumbs (movie,document,audio) if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension)) { $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension; //thumb cropping $pic_row['system_icon'] = true; break 2; } } } else { // Check for file-specific thumbs for system files foreach ($thumb_extensions as $extension) { if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $file_base_name . $extension)) { $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $file_base_name . $extension; //thumb cropping $pic_row['system_icon'] = true; break 2; } } // foreach $thumb_extensions } // else $system_pic } // if is_dir($default_thumb_path) } // foreach $thumbpaths } // if is_null($filepathname) if ($filepathname) { $filepathname = path2url($filepathname); } } if (is_null($filepathname)) { $localpath = $pic_row['filepath'] . $pic_prefix[$mode] . $pic_row['filename']; // Check here that the filename we are going to return exists // If it doesn't exist we return a placeholder image // We then log the missing file for the admin's attention if (file_exists($url_prefix[$pic_row['url_prefix']] . $localpath)) { $filepathname = $url_prefix[$pic_row['url_prefix']] . path2url($localpath); } else { $filepathname = 'images/thumbs/thumb_nopic.png'; $pic_row['system_icon'] = true; if ($CONFIG['log_mode'] != 0) { log_write("File {$url_prefix[$pic_row['url_prefix']]}{$localpath} is missing."); } } } // Added hack: "&& !isset($pic_row['mode'])" thumb_data filter isn't executed for the fullsize image if ($mode == 'thumb' && !isset($pic_row['mode'])) { $pic_row['url'] = $filepathname; $pic_row['mode'] = $mode; $pic_row = CPGPluginAPI::filter('thumb_data', $pic_row); } elseif ($mode != 'thumb') { $pic_row['url'] = $filepathname; $pic_row['mode'] = $mode; } else { $pic_row['url'] = $filepathname; } $pic_row = CPGPluginAPI::filter('picture_url', $pic_row); return $pic_row['url']; }
function get_pic_url(&$pic_row, $mode) { global $CONFIG, $THEME_DIR; static $pic_prefix = array(); static $url_prefix = array(); if (!count($pic_prefix)) { $pic_prefix = array('thumb' => $CONFIG['thumb_pfx'], 'normal' => $CONFIG['normal_pfx'], 'fullsize' => ''); $url_prefix = array(0 => $CONFIG['fullpath']); } $mime_content = get_type($pic_row['filename']); $filepathname = null; // Code to handle custom thumbnails // If fullsize or normal mode use regular file if ($mime_content['content'] != 'image' && $mode != 'thumb') { $mode = 'fullsize'; } elseif ($mime_content['content'] != 'image' && $mode == 'thumb') { $thumb_extensions = array('.gif', '.png', '.jpg'); // Check for user-level custom thumbnails // Create custom thumb path and erase extension using filename; Erase filename's extension $custom_thumb_path = $url_prefix[$pic_row['url_prefix']] . $pic_row['filepath'] . $pic_prefix[$mode]; $file_base_name = str_replace('.' . $mime_content['extension'], '', basename($pic_row['filename'])); // Check for file-specific thumbs foreach ($thumb_extensions as $extension) { if (file_exists($custom_thumb_path . $file_base_name . $extension)) { $filepathname = $custom_thumb_path . $file_base_name . $extension; break; } } // Check for extension-specific thumbs if (is_null($filepathname)) { foreach ($thumb_extensions as $extension) { if (file_exists($custom_thumb_path . $mime_content['extension'] . $extension)) { $filepathname = $custom_thumb_path . $mime_content['extension'] . $extension; break; } } } // Check for content-specific thumbs if (is_null($filepathname)) { foreach ($thumb_extensions as $extension) { if (file_exists($custom_thumb_path . $mime_content['content'] . $extension)) { $filepathname = $custom_thumb_path . $mime_content['content'] . $extension; break; } } } // Use default thumbs if (is_null($filepathname)) { // Check for default theme- and global-level thumbs $thumb_paths[] = $THEME_DIR . '/images/'; // Used for custom theme thumbs $thumb_paths[] = 'images/'; // Default Coppermine thumbs foreach ($thumb_paths as $default_thumb_path) { if (is_dir($default_thumb_path)) { foreach ($thumb_extensions as $extension) { // Check for extension-specific thumbs if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension)) { $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['extension'] . $extension; break 2; } } foreach ($thumb_extensions as $extension) { // Check for media-specific thumbs (movie,document,audio) if (file_exists($default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension)) { $filepathname = $default_thumb_path . $CONFIG['thumb_pfx'] . $mime_content['content'] . $extension; break 2; } } } } } return path2url($filepathname); } return $url_prefix[$pic_row['url_prefix']] . path2url($pic_row['filepath'] . $pic_prefix[$mode] . $pic_row['filename']); }
/** * picrow() * * return the HTML code for a row to be displayed for an image * the row contains a checkbox, the image name, a thumbnail * * @param $picfile the full path of the file that contains the picture * @param $picid the name of the check box * @return the HTML code */ function picrow($picfile, $picid, $albid) { global $CONFIG, $expic_array; $encoded_picfile = base64_encode($picfile); $picname = $CONFIG['fullpath'] . $picfile; $pic_url = urlencode($picfile); $pic_fname = basename($picfile); $pic_dirname = dirname($picname); $thumb_file = dirname($picname) . '/' . $CONFIG['thumb_pfx'] . $pic_fname; if (file_exists($thumb_file)) { $thumb_info = getimagesize($picname); $thumb_size = compute_img_size($thumb_info[0], $thumb_info[1], 48); $img = '<img src="' . path2url($thumb_file) . '" ' . $thumb_size['geom'] . ' class="thumbnail" border="0" alt="" />'; } elseif (is_image($picname)) { $img = '<img src="showthumb.php?picfile=' . $pic_url . '&size=48" class="thumbnail" border="0" alt="" />'; } else { $file['filepath'] = $pic_dirname . '/'; //substr($picname,0,strrpos($picname,'/')) $file['filename'] = $pic_fname; $filepathname = get_pic_url($file, 'thumb'); //$mime_content = cpg_get_type($picname); //$extension = file_exists("images/thumb_{$mime_content['extension']}.jpg") ? $mime_content['extension']:$mime_content['content']; //$img = '<img src="images/thumb_'.$extension.'.jpg" class="thumbnail" width="48" border="0" alt="" />'; $img = '<img src="' . $filepathname . '" class="thumbnail" width="48" border="0" alt="" />'; } if (filesize($picname) && is_readable($picname)) { //$fullimagesize = getimagesize($picname); COMMENTED OUT FOR VIDEO SUPPORT $winsizeX = $fullimagesize[0] + 16; $winsizeY = $fullimagesize[1] + 16; //$checked = isset($expic_array[$picfile]) || !$fullimagesize ? '' : 'checked'; $checked = isset($expic_array[$picfile]) ? '' : 'checked'; return <<<EOT <tr> <td class="tableb" valign="middle"> <input name="pics[]" id="picselector" type="checkbox" value="{$picid}" {$checked} /> <input name="album_lb_id_{$picid}" type="hidden" value="{$albid}" /> <input name="picfile_{$picid}" type="hidden" value="{$encoded_picfile}" /> </td> <td class="tableb" valign="middle" width="100%"> <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')">{$pic_fname}</a> </td> <td class="tableb" valign="middle" align="center"> <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')"><img src="images/spacer.gif" width="1" height="48" border="0" alt="" />{$img}<br /></a> </td> </tr> EOT; } else { $winsizeX = 300; $winsizeY = 300; return <<<EOT <tr> <td class="tableb" valign="middle"> </td> <td class="tableb" valign="middle" width="100%"> <i>{$pic_fname}</i> </td> <td class="tableb" valign="middle" align="center"> <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')"><img src="showthumb.php?picfile={$pic_url}&size=48" class="thumbnail" border="0" alt="" /><br /></a> </td> </tr> EOT; } }
} else { echo path2url($mergedFile); @unlink($video); @unlink($audio); } } else { echo "Problem writing video file to disk!"; } } else { if (isset($_FILES["audio-blob"])) { $audio = getcwd() . '/uploads/' . $_POST["audio-filename"]; if (move_uploaded_file($_FILES["audio-blob"]["tmp_name"], $audio)) { echo path2url($audio); } else { echo "Problem writing video file to disk!"; } } else { if (isset($_FILES["video-blob"])) { $video = getcwd() . '/uploads/' . $_POST["video-filename"]; if (move_uploaded_file($_FILES["video-blob"]["tmp_name"], $video)) { echo path2url($video); } else { echo "Problem writing video file to disk!"; } } } } function path2url($file, $Protocol = 'http://') { return $Protocol . str_replace(str_replace("\\", '/', $_SERVER['DOCUMENT_ROOT']), $_SERVER['HTTP_HOST'] . '/', str_replace("\\", '/', $file)); }
/** * picrow() * * return the HTML code for a row to be displayed for an image * the row contains a checkbox, the image name, a thumbnail * * @param $picfile the full path of the file that contains the picture * @param $picid the name of the check box * @return the HTML code */ function picrow($picfile, $picid, $albid) { global $CONFIG, $expic_array, $picrowCounter; $encoded_picfile = urlencode(base64_encode($picfile)); $picname = $CONFIG['fullpath'] . $picfile; $pic_url = urlencode($picfile); $pic_fname = basename($picfile); $pic_dirname = dirname($picname); $thumb_file = dirname($picname) . '/' . $CONFIG['thumb_pfx'] . $pic_fname; if ($CONFIG['display_thumbs_batch_add'] == 1) { if (file_exists($thumb_file)) { $thumb_info = cpg_getimagesize($picname); $thumb_size = compute_img_size($thumb_info[0], $thumb_info[1], 48); $img = '<img src="' . path2url($thumb_file) . '" ' . $thumb_size['geom'] . ' class="thumbnail" border="0" alt="" />'; } elseif (is_image($picname)) { $img = '<img src="showthumb.php?picfile=' . $pic_url . '&size=48" class="thumbnail" border="0" alt="" />'; } else { $file['filepath'] = $pic_dirname . '/'; $file['filename'] = $pic_fname; $filepathname = get_pic_url($file, 'thumb'); $img = '<img src="' . $filepathname . '" class="thumbnail" width="48" border="0" alt="" />'; } } else { $img = ''; } if (filesize($picname) && is_readable($picname)) { // for video support, maybe check: http://www.getid3.org/ // for now, hack in something that works (don't check !$fullimagesize) $fullimagesize = cpg_getimagesize($picname); $winsizeX = $fullimagesize[0] + 16; $winsizeY = $fullimagesize[1] + 16; // $checked = isset($expic_array[$picfile]) || !$fullimagesize ? '' : 'checked'; $picfile_replaced_forbidden = dirname($picfile) . '/' . replace_forbidden(basename($picfile)); if ($CONFIG['batch_add_hide_existing_files'] && isset($expic_array[$picfile_replaced_forbidden])) { return; } if ($picrowCounter++ % 2) { $rowStyle = 'tableb'; } else { $rowStyle = 'tableb tableb_alternate'; } $checked = isset($expic_array[$picfile_replaced_forbidden]) || !is_known_filetype($pic_fname) ? '' : 'checked="checked"'; $return = <<<EOT <tr> <td class="{$rowStyle}" valign="middle" width="30"> <input name="pics[]" id="checkbox_p_{$picid}" type="checkbox" value="{$picid}" {$checked} /> <input name="album_lb_id_{$picid}" type="hidden" value="{$albid}" /> <input name="picfile_{$picid}" type="hidden" value="{$encoded_picfile}" /> </td> EOT; // if $fullimagesize is not null, then assume it's an image if ($fullimagesize) { $return .= <<<EOT <td class="{$rowStyle}" valign="middle"> <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')">{$pic_fname}</a> </td> <td class="{$rowStyle}" valign="middle" align="center"> <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')"> EOT; } else { // assume it's not an image so hope that browser can display/play it with a helper app $nonpic_url = rawurldecode($pic_url); $return .= <<<EOT <td class="{$rowStyle}" valign="middle"> <a href="javascript:;" onclick= "MM_openBrWindow('{$CONFIG['fullpath']}{$nonpic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')">{$pic_fname}</a> </td> <td class="{$rowStyle}" valign="middle" align="center"> <a href="javascript:;" onclick= "MM_openBrWindow('{$CONFIG['fullpath']}{$nonpic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')"> EOT; } if ($CONFIG['display_thumbs_batch_add'] == 1) { $return .= <<<EOT <img src="images/spacer.gif" width="1" height="48" border="0" alt="" /> EOT; } $return .= <<<EOT {$img}</a><br /> </td> <td class="{$rowStyle}" valign="middle" width="100" height="40"> <p id="p_{$picid}" name="addpic.php?pic_file={$encoded_picfile}"></p> </td> </tr> EOT; return $return; } else { $winsizeX = 300; $winsizeY = 300; $return = <<<EOT <tr> <td class="{$rowStyle}" valign="middle"> </td> <td class="{$rowStyle}" valign="middle"> <i>{$pic_fname}</i> </td> <td class="{$rowStyle}" valign="middle" align="center"> <a href="javascript:;" onclick= "MM_openBrWindow('displayimage.php?fullsize=1&picfile={$pic_url}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, width={$winsizeX}, height={$winsizeY}')"> EOT; if ($CONFIG['display_thumbs_batch_add'] == 1) { $return .= <<<EOT <img src="showthumb.php?picfile={$pic_url}&size=48" class="thumbnail" border="0" alt="" /> EOT; } $return .= <<<EOT </a> </td> </tr> EOT; return $return; } }
function enlargeit_addparams($params) { global $thumb, $CONFIG, $template_thumbnail_view, $CURRENT_PIC_DATA, $enlargeit_supported_image_file_array, $enlargeit_supported_video_file_array; // enabled for current user type? if (GALLERY_ADMIN_MODE && !$CONFIG['plugin_enlargeit_adminmode']) { return $params; } if (USER_ID && !$CONFIG['plugin_enlargeit_registeredmode']) { return $params; } if (!USER_ID && !$CONFIG['plugin_enlargeit_guestmode']) { return $params; } // Populate the list of files that this plugin should be used with in the first place $image_array = explode('/', $CONFIG['plugin_enlargeit_img_types']); $movie_array = explode('/', $CONFIG['plugin_enlargeit_mov_types']); $enl_filetyplower = strtolower(ltrim(substr($thumb['filename'], strrpos($thumb['filename'], '.')), '.')); if (substr($thumb['filename'], 0, 8) == 'youtube_') { $enl_filetyplower = 'ytb'; } // get file path depending if normal size pic exists and config setting enl_pictype if ($CONFIG['plugin_enlargeit_pictype'] == '1') { $enl_path = $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename']; } elseif ($CONFIG['plugin_enlargeit_pictype'] == '2') { $enl_path = $CONFIG['fullpath'] . $thumb['filepath'] . $CONFIG['normal_pfx'] . $thumb['filename']; } elseif ($CONFIG['plugin_enlargeit_pictype'] == '0' && is_file($CONFIG['fullpath'] . $thumb['filepath'] . $CONFIG['normal_pfx'] . $thumb['filename'])) { $enl_path = $CONFIG['fullpath'] . $thumb['filepath'] . $CONFIG['normal_pfx'] . $thumb['filename']; } else { $enl_path = $CONFIG['fullpath'] . $thumb['filepath'] . $thumb['filename']; } // CASE 1: images if (in_array($enl_filetyplower, $image_array) == TRUE) { $enl_newthumb = '<img src="' . $CONFIG['fullpath'] . $thumb['filepath'] . $CONFIG['thumb_pfx'] . $thumb['filename'] . '" '; $enl_newthumb .= 'class="enlargeimg" '; if ($CONFIG['thumb_use'] == 'any' && $thumb['pwidth'] >= $thumb['pheight'] || $CONFIG['thumb_use'] == 'wd') { $enl_thumbheight = round($thumb['pheight'] / $thumb['pwidth'] * $CONFIG['thumb_width']); $enl_newthumb .= 'width="' . $CONFIG['thumb_width'] . '" height="' . $enl_thumbheight . '" '; } elseif ($CONFIG['thumb_use'] == 'any' && $thumb['pwidth'] < $thumb['pheight'] || $CONFIG['thumb_use'] == 'ht') { $enl_thumbwidth = round($thumb['pwidth'] / $thumb['pheight'] * $CONFIG['thumb_width']); $enl_newthumb .= 'width="' . $enl_thumbwidth . '" height="' . $CONFIG['thumb_width'] . '" '; } $enl_newthumb .= 'border="0" onclick="enlarge(this);" longdesc="' . path2url($enl_path) . '" name="' . $thumb['pid'] . '" '; $enl_newthumb .= 'alt="' . $thumb['title'] . '" />'; $more_params = array('{LINK_ONCLICK}' => 'onclick="return false;"', '{THUMB}' => $enl_newthumb); } elseif (in_array($enl_filetyplower, $movie_array) == TRUE) { $pid = $thumb['pid']; // For flash or movie files we need some more data from the database $result = cpg_db_query("SELECT aid from {$CONFIG['TABLE_PICTURES']} WHERE pid='{$pid}' LIMIT 1"); $row = mysql_fetch_array($result); $album = $row['aid']; $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false); for ($pos = 0; $pic_data[$pos]['pid'] != $pid && $pos < $pic_count; $pos++) { $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false); } $CURRENT_PIC_DATA = $pic_data[0]; if ($CURRENT_PIC_DATA['pwidth'] == 0) { $CURRENT_PIC_DATA['pwidth'] = 500; } if ($CURRENT_PIC_DATA['pheight'] == 0) { $CURRENT_PIC_DATA['pheight'] = 410; } if ($enl_filetyplower == 'swf') { $enl_newthumb = '<img src="images/thumbs/thumb_swf.png" class="enlargeimg" width="' . $thumb['pwidth'] . '" height="' . $thumb['pheight'] . '" '; } else { $enl_newthumb = '<img src="images/thumbs/thumb_movie.png" class="enlargeimg" width="' . $thumb['pwidth'] . '" height="' . $thumb['pheight'] . '" '; } $enl_newthumb .= 'border="0" onclick="enlarge(this);" '; if ($enl_filetyplower == 'swf') { $enl_newthumb .= 'longdesc="swf::' . path2url($enl_path) . '::' . $CURRENT_PIC_DATA['pwidth'] . '::' . $CURRENT_PIC_DATA['pheight'] . '" '; } elseif ($enl_filetyplower == 'flv') { if ($CONFIG['plugin_enlargeit_flvplayer'] == '0') { $enl_newthumb .= 'longdesc="fl2::../../../../' . path2url($enl_path) . '::' . $CURRENT_PIC_DATA['pwidth'] . '::' . $CURRENT_PIC_DATA['pheight'] . '" '; } else { $enl_newthumb .= 'longdesc="flv::../../../../' . path2url($enl_path) . '::' . $CURRENT_PIC_DATA['pwidth'] . '::' . $CURRENT_PIC_DATA['pheight'] . '" '; } } elseif ($enl_filetyplower == 'dvx') { $enl_newthumb .= 'longdesc="dvx::' . path2url($enl_path) . '::' . $CURRENT_PIC_DATA['pwidth'] . '::' . $CURRENT_PIC_DATA['pheight'] . '" '; } $enl_newthumb .= 'name="' . $thumb['pid'] . '" alt="" title="' . $thumb['title'] . '" />'; $more_params = array('{LINK_ONCLICK}' => 'onclick="return false;"', '{THUMB}' => $enl_newthumb); } else { $more_params = array('{LINK_ONCLICK}' => ''); } return array_merge($params, $more_params); }
echo '<p>File Updated</p>'; } } else { if ($numAliases > 0) { echo '<p>The Alias: ' . $alias->getAlias() . ' already exists</p>'; } else { if ($alias->getAlias() == "/") { echo '<p>Alias cannot be saved as /</p>'; //shouldnt occur } else { echo '<p>Couldnt save...</p>'; } } } } $fileUploadPath = path2url(str_replace('//', '/', DIRECTORY_SEPARATOR . UPLOAD_FOLDER_NAME . DIRECTORY_SEPARATOR . $uploadTo . issetOrBlank($_FILES["file-file"]['name']))); //$fileUploadPath = str_replace('//','/',$fileUploadPath); echo '<p>File Link: <a href="' . $fileUploadPath . '" target="_blank">' . issetOrBlank($_FILES["file-file"]['name']) . '</a></p>'; echo '<textarea style="width: 100%;"><a href="' . $fileUploadPath . '" target="_blank">' . issetOrBlank($_FILES["file-file"]['name']) . '</a></textarea>'; } exit; ?> </body> </html> <?php } ?> <html> <head> <title>File Upload</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/cupertino/jquery-ui.css" />
if ($ext === 'png') { $source_image = imagecreatefrompng($src); } else { $source_image = imagecreatefromjpeg($src); } $width = imagesx($source_image); $height = imagesy($source_image); $desired_height = floor($height * ($desired_width / $width)); $virtual_image = imagecreatetruecolor($desired_width, $desired_height); if ($ext === 'png') { imagecolortransparent($virtual_image, imagecolorallocate($virtual_image, 0, 0, 0)); imagealphablending($virtual_image, false); imagesavealpha($virtual_image, true); } imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height); if ($ext === 'png') { imagepng($virtual_image, $dest); } else { imagejpeg($virtual_image, $dest); } } $target_dir = __DIR__ . "/gallery"; $thumbnail_dir = $target_dir . "/thumbnails"; $file = $_FILES["upload_file"]; $target_file = $target_dir . '/' . basename($file["name"]); $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION); if (in_array($imageFileType, ['jpg', 'jpeg', 'png', 'gif'], false)) { move_uploaded_file($file["tmp_name"], $target_file); make_thumb($target_file, $thumbnail_dir . '/' . basename($file["name"]), 300); echo json_encode([$file["name"] => ["url" => path2url($target_dir . '/' . $file["name"])]]); }
function anis_display_fullsize_pic() { global $CONFIG, $THEME_DIR, $ALBUM_SET; global $lang_errors, $lang_fullsize_popup, $lang_charset; $superCage = Inspekt::makeSuperCage(); if ($superCage->get->keyExists('picfile')) { if (!GALLERY_ADMIN_MODE) { cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); } $picfile = $superCage->get->getRaw('picfile'); $picname = $CONFIG['fullpath'] . $picfile; $imagesize = @getimagesize($picname); $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]); } elseif ($superCage->get->keyExists('pid')) { $pid = $superCage->get->getInt('pid'); $sql = "SELECT * " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$pid}' {$ALBUM_SET}"; $result = cpg_db_query($sql); if (!mysql_num_rows($result)) { cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); } $row = mysql_fetch_array($result); $pic_url = get_pic_url($row, 'fullsize'); $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"'; $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title><?php echo $CONFIG['gallery_name']; ?> : <?php echo $lang_fullsize_popup['click_to_close']; ?> </title> <meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset']; ?> " /> <script type="text/javascript"> function adjust_popup() { var w, h, fixedW, fixedH, diffW, diffH; if (document.documentElement && document.body.clientHeight==0) { // Catches IE6 and FF in DOCMODE fixedW = document.documentElement.clientWidth; fixedH = document.documentElement.clientHeight; window.resizeTo(fixedW, fixedH); diffW = fixedW - document.documentElement.clientWidth; diffH = fixedH - document.documentElement.clientHeight; w = fixedW + diffW + 16; // Vert Scrollbar Always On in DOCMODE. h = fixedH + diffH; if (w >= screen.availWidth) h += 16; } else if (document.all) { fixedW = document.body.clientWidth; fixedH = document.body.clientHeight; window.resizeTo(fixedW, fixedH); diffW = fixedW - document.body.clientWidth; diffH = fixedH - document.body.clientHeight; w = fixedW + diffW; h = fixedH + diffH; if (h >= screen.availHeight) w += 16; if (w >= screen.availWidth) h += 16; } else { fixedW = window.innerWidth; fixedH = window.innerHeight; window.resizeTo(fixedW, fixedH); diffW = fixedW - window.innerWidth; diffH = fixedH - window.innerHeight; w = fixedW + diffW; h = fixedH + diffH; if (w >= screen.availWidth) h += 16; if (h >= screen.availHeight) w += 16; } w = Math.min(w,screen.availWidth); h = Math.min(h,screen.availHeight); paspect = <?php echo $row['pwidth'] / $row['pheight']; ?> ; // Picture aspect ratio caspect = w/h; // Current aspect ratio if (paspect > caspect) { h = Math.round(h / paspect * caspect); // Adjust height } if (paspect < caspect) { w = Math.round(w / caspect * paspect); // Adjust width } window.resizeTo(w,h); window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2); // alert('<!-- width: ' + w + ' height: ' + h + ' --> '); //applet_tag='<APPLET codebase=\"plugins/CPGAnis/anis\" code=\"AniS.class\" width=\"' + w + '\" height=\"' + h + '\">'; applet_tag1='<PARAM name=\"image_window_size\" value=\"'+(w-diffW)+','+(h-diffH)+'\">\n'; applet_tag2='<APPLET codebase=\"plugins/CPGAnis/anis\" code=\"AniS.class\" width=\"'+ (w-diffW-5) +'\" height=\"' + (h-diffH-7) + '\">\n'; applet_tag=applet_tag2+applet_tag1; } </script> <style type="text/css"> body { margin: 0; padding: 0; background-color: gray; } img { margin:0; padding:0; border:0; } #content { margin:0 auto; padding:0; border:0; } table { border:0; height:100%; width:100%; border-collapse:collapse} td { vertical-align: middle; text-align:center; } applet {border:0, margin:0; padding:0;} </style> </head> <body> <script language="JavaScript" type="text/JavaScript"> adjust_popup(); </script> <table> <tr> <td> <div id="content"> <script language="JavaScript" type="text/JavaScript"> document.write(applet_tag); </script> <PARAM name="active_zoom" value="x"> <?php echo ' <PARAM name="filenames" value="' . htmlspecialchars($imagedata['path']) . '"> '; ?> </APPLET> </div> </td> </tr> </table> </body> </html> <?php }
/** * picrow() * * return the HTML code for a row to be displayed for an image * the row contains a checkbox, the image name, a thumbnail * * @param $picfile the full path of the file that contains the picture * @param $picid the name of the check box * @return the HTML code */ function picrow($picfile, $picid, $albid) { global $db, $CONFIG, $expic_array, $module_name; $encoded_picfile = base64_encode($picfile); $picname = $CONFIG['fullpath'] . $picfile; $pic_url = urlencode($picfile); $pic_fname = basename($picfile); $pic_dname = substr($picname, 0, -strlen($pic_fname)); if ($CONFIG['samename'] == 1) { $sql = "SELECT * FROM " . $CONFIG['TABLE_PICTURES'] . " WHERE filename='" . Fix_Quotes($pic_fname) . "' AND filepath='{$pic_dname}'"; } else { $sql = "SELECT * FROM " . $CONFIG['TABLE_PICTURES'] . " WHERE filename ='" . Fix_Quotes($pic_fname) . "'"; } $result = $db->sql_query($sql); $exists = $db->sql_numrows($result); while ($exists <= 0) { $thumb_file = dirname($picname) . '/' . $CONFIG['thumb_pfx'] . $pic_fname; if (file_exists($thumb_file)) { $thumb_info = getimagesize($picname); $thumb_size = compute_img_size($thumb_info[0], $thumb_info[1], 48); $img = '<img src="' . path2url($picname) . '" ' . $thumb_size['geom'] . ' class="thumbnail" border="0" alt="" />'; } else { $img = '<img src="' . URL::index($module_name . '&file=showthumbbatch&picfile=' . $pic_url . '&size=48', 0) . '" class="thumbnail" border="0" alt="" />'; } $piclink = URL::index("&file=displayimagepopup&fullsize=1&picfile={$pic_url}"); if (filesize($picname) && is_readable($picname)) { $fullimagesize = getimagesize($picname); $winsizeX = $fullimagesize[0] + 16; $winsizeY = $fullimagesize[1] + 16; $checked = isset($expic_array[$picfile]) || !$fullimagesize ? '' : 'checked'; return <<<EOT \t\t<tr> \t\t\t\t<td class="tableb" valign="middle"> \t\t\t\t\t\t<input name="pics[]" type="checkbox" value="{$picid}" {$checked} /> \t\t\t\t\t\t<input name="album_lb_id_{$picid}" type="hidden" value="{$albid}" /> \t\t\t\t\t\t<input name="picfile_{$picid}" type="hidden" value="{$encoded_picfile}" /> \t\t\t\t</td> \t\t\t\t<td class="tableb" valign="middle" width="100%"> \t\t\t\t\t\t<a href="javascript:;" onclick= "MM_openBrWindow('{$piclink}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, scrollbars=yes, width={$winsizeX}, height={$winsizeY}')">{$pic_fname}</a> \t\t\t\t</td> \t\t\t\t<td class="tableb" valign="middle" align="center"> \t\t\t\t\t\t<a href="javascript:;" onclick= "MM_openBrWindow('{$piclink}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, scrollbars=yes, width={$winsizeX}, height={$winsizeY}')">{$img}<br /></a> \t\t\t\t</td> \t\t</tr> EOT; } else { $winsizeX = 300; $winsizeY = 300; return <<<EOT \t\t<tr> \t\t\t\t<td class="tableb" valign="middle"> \t\t\t\t\t\t \t\t\t\t</td> \t\t\t\t<td class="tableb" valign="middle" width="100%"> \t\t\t\t\t\t<i>{$pic_fname}</i> \t\t\t\t</td> \t\t\t\t<td class="tableb" valign="middle" align="center"> \t\t\t\t\t\t<a href="javascript:;" onclick= "MM_openBrWindow('{$piclink}', 'ImageViewer', 'toolbar=yes, status=yes, resizable=yes, scrollbars=yes, width={$winsizeX}, height={$winsizeY}')"><img src="'.URL::index(&file=showthumbbatch&picfile={$pic_url}&size=48).'" class="thumbnail" border="0" alt="" /><br /></a> \t\t\t\t</td> \t\t</tr> EOT; } } }
$i = 100; $lb = ''; $j = 1; if (count($rowset) > 0) { foreach ($rowset as $picture) { $get_photo_name = $picture['title']; $picname = $CONFIG['fullpath'] . $picture['filepath'] . $picture['filename']; $pic_url = urlencode($picture['filename']); $pic_fname = basename($picture['filename']); $pic_dirname = dirname($picname); $thumb_file = dirname($picname) . '/' . $CONFIG['thumb_pfx'] . $pic_fname; $img = ''; if (file_exists($thumb_file)) { $thumb_info = cpg_getimagesize($picname); $thumb_size = compute_img_size($thumb_info[0], $thumb_info[1], 48); $img = '<img src="' . path2url($thumb_file) . '" ' . $thumb_size['geom'] . ' class="thumbnail" border="0" alt="" title="' . $get_photo_name . '" />'; } elseif (is_image($picname)) { $img = '<img src="showthumb.php?picfile=' . $pic_url . '&size=48" class="thumbnail" border="0" alt="" title="' . $get_photo_name . '" />'; } else { $file['filepath'] = $pic_dirname . '/'; $file['filename'] = $pic_fname; $filepathname = get_pic_url($file, 'thumb'); $img = '<img src="' . $filepathname . '" class="thumbnail" width="48" border="0" alt="" title="' . $get_photo_name . '" />'; } $unique_id = uniqid(rand()); $pic_title = $picture['title'] ? "<strong>{$picture['title']}</strong><br />\n" : ''; $lb .= <<<EOT <tr id="sort-{$picture['pid']}"> <td class="dragHandle"></td> <td valign="middle"> {$pic_title}
function display_fullsize_pic() { global $CONFIG, $HTTP_GET_VARS, $THEME_DIR, $ALBUM_SET; global $lang_errors, $lang_fullsize_popup, $lang_charset; if (function_exists('theme_display_fullsize_pic')) { theme_display_fullsize_pic(); return; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title><?php echo $CONFIG['gallery_name']; ?> : <?php echo $lang_fullsize_popup['click_to_close']; ?> </title> <meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset']; ?> " /> <link rel="stylesheet" href="<?php echo $THEME_DIR; ?> style.css" /> <script type="text/javascript" src="scripts.js"></script> </head> <body scroll="auto" marginwidth="0" marginheight="0"> <script language="JavaScript" type="text/JavaScript"> adjust_popup(); </script> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="2"> <td align="center" valign="middle"> <table cellspacing="2" cellpadding="0" style="border: 1px solid #000000; background-color: #FFFFFF;"> <td> <?php if (isset($HTTP_GET_VARS['picfile'])) { if (!GALLERY_ADMIN_MODE) { cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); } $picfile = $HTTP_GET_VARS['picfile']; $picname = $CONFIG['fullpath'] . $picfile; $imagesize = @getimagesize($picname); echo "<a href=\"javascript: window.close()\"><img src=\"" . path2url($picname) . "\" {$imagesize['3']} class=\"image\" border=\"0\" alt=\"\" title=\"{$picfile}\n" . $lang_fullsize_popup['click_to_close'] . "\"/></a><br />\n"; } elseif (isset($HTTP_GET_VARS['pid'])) { $pid = (int) $HTTP_GET_VARS['pid']; $sql = "SELECT * " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$pid}' {$ALBUM_SET}"; $result = db_query($sql); if (!mysql_num_rows($result)) { cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); } $row = mysql_fetch_array($result); $pic_url = get_pic_url($row, 'fullsize'); $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"'; echo "<a href=\"javascript: window.close()\"><img src=\"" . $pic_url . "\" {$geom} class=\"image\" border=\"0\" alt=\"\" title=\"" . htmlspecialchars($row['filename']) . "\n" . $lang_fullsize_popup['click_to_close'] . "\"></a><br />\n"; } ?> </td> </table> </td> </table> </body> </html> <?php }
case 'cinco': //Se genera el HTML full if (get_post_meta($post_ID, "all2html_ok", true) == 'ok') { $pdfoptpath = get_post_meta($post_ID, "all2html_pdfoptpath", true); $htmlpath = get_post_meta($post_ID, "all2html_path", true); $uppath = str_replace($_SERVER['DOCUMENT_ROOT'], '', $htmlpath); $archivo = get_post_meta($post_ID, "all2html_arch", true); if (wp_mkdir_p($htmlpath . '/fullhtml')) { $full_html = '/usr/local/bin/pdf2htmlEX --fit-width 1240 --embed cfijo --no-drm 1 --optimize-text 1 --dest-dir ' . $htmlpath . '/fullhtml --external-hint-tool=/usr/local/bin/ttfautohint ' . $pdfoptpath . ' 2>&1'; exec($full_html, $outfull); $outfull = implode("\n", $outfull); update_post_meta($post_ID, 'output_full', $outfull); update_post_meta($post_ID, 'all2html_fullhtml', $uppath . '/fullhtml/' . sanitize_file_name($archivo['filename']) . '-o.html'); } if (function_exists('w3tc_pgcache_flush_post')) { w3tc_pgcache_flush_post($post_ID); } if (file_exists($htmlpath . '/' . sanitize_file_name($archivo['filename']) . '-o.php')) { echo path2url($htmlpath . '/fullhtml/' . sanitize_file_name($archivo['filename']) . '-o.html'); } else { echo 'error'; } } break; default: echo '<h2>¡No deberías estar aquí!</h2>'; break; } } else { echo '<h2>¡No deberías estar aquí!</h2>'; }
} else { echo '<option value="' . $type . '">' . $type . '</option>'; } } ?> </select> </td> </tr> <tr> <td>File</td> <td> <p>If you wish to overide the file, select a new one here, otherwise leave it blank.</p> <input type="file" name="file-file" disabled/><br /> <?php $fileUploadPath = path2url(DIRECTORY_SEPARATOR . UPLOAD_FOLDER_NAME . DIRECTORY_SEPARATOR . $file->getPath()); echo '<p>Current file: <a href="' . $fileUploadPath . '" target="_blank">' . substr($file->getPath(), strrpos($file->getPath(), DIRECTORY_SEPARATOR) + 1) . '</a>'; ?> </td> </tr> <tr> <td>Move File on new uploaded?</td> <td>Check this box, if you want a newly updated file to sit in a location as designated by the {Campus}/{Category}/{Faculty}.<br />Leaving this unchecked with a new file, will just replace the existing file. *Note, ensure the replacement file is the same type as the previous.<br /> <input type="checkbox" name="moveFile" value="1" disabled/> </td> <tr> <tr> <td>File Active: </td> <td>
function theme_display_fullsize_pic() { global $CONFIG, $THEME_DIR, $ALBUM_SET, $pid; global $lang_errors, $lang_fullsize_popup, $lang_charset; $superCage = Inspekt::makeSuperCage(); if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) { printf($lang_errors['login_needed'], '', '', '', ''); die; } //if (isset($_GET['picfile'])){ if ($superCage->get->keyExists('picfile')) { if (!GALLERY_ADMIN_MODE) { cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); } //$picfile = $_GET['picfile']; $picfile = $superCage->get->getPath('picfile'); $picname = $CONFIG['fullpath'] . $picfile; $imagesize = @getimagesize($picname); $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]); } elseif (pid) { //$pid = (int)$_GET['pid']; $sql = "SELECT * " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$pid}' {$ALBUM_SET}"; $result = cpg_db_query($sql); if (!mysql_num_rows($result)) { cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); } $row = mysql_fetch_array($result); $pic_url = get_pic_url($row, 'fullsize'); $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"'; $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom); } if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) { // adjust the size of the window if we don't have to catter for a full-size pop-up, but only a text message $row['pwidth'] = 200; $row['pheight'] = 100; } $fullImageUrl = '<img src="' . htmlspecialchars($imagedata['path']) . '" />'; $fullTitle_caption = "<h3><strong>" . htmlspecialchars($row['title']) . "</strong></h3>"; $fullTitle_caption .= "<p>" . htmlspecialchars($row['caption']) . "</p>"; if ($superCage->get->keyExists('full_image_ajax')) { $fullImageData = array('url' => $fullImageUrl, 'title' => $fullTitle_caption); $full_jons = json_encode($fullImageData); echo $full_jons; exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset']; ?> " /> <title><?php echo $CONFIG['gallery_name']; ?> : <?php echo $lang_fullsize_popup['click_to_close']; ?> </title> <style type="text/css"> body { margin: 0; padding: 0; background-color: gray; } img { margin:0; padding:0; border:0; } #content { margin:0 auto; padding:0; border:0; } table { border:0; width:<?php echo $row['pwidth']; ?> px; height:<?php echo $row['pheight']; ?> px; border-collapse:collapse} td { vertical-align: middle; text-align:center; } </style> <script type="text/javascript" src="scripts.js"></script> </head> <body style="margin:0px; padding:0px; background-color: gray;"> <script language="JavaScript" type="text/JavaScript"> adjust_popup(); </script> <?php if ($CONFIG['transparent_overlay'] == 1) { ?> <table cellpadding="0" cellspacing="0" align="center" style="padding:0px;"> <tr> <?php echo '<td align="center" valign="middle" background="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . ' class="image">'; echo '<div id="content">'; echo '<a href="javascript: window.close()" style="border:none"><img src="images/image.gif?id=' . floor(rand() * 1000 + rand()) . '&fullsize=yes" ' . $imagedata['geometry'] . ' alt="' . htmlspecialchars($imagedata['name']) . '" title="' . htmlspecialchars($imagedata['name']) . "\n" . $lang_fullsize_popup['click_to_close'] . '" /></a><br />' . "\n"; ?> </div> </td> </tr> </table> <?php } else { ?> <table class="fullsize"> <tr> <td> <div id="content"> <?php echo '<a href="javascript: window.close()"><img src="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . 'alt="' . htmlspecialchars($imagedata['name']) . '" title="' . htmlspecialchars($imagedata['name']) . "\n" . $lang_fullsize_popup['click_to_close'] . '" /></a><br />' . "\n"; ?> </div> </td> </tr> </table> <?php } ?> </body> </html> <?php }
echo $lang_fullsize_popup["click_to_close"]; ?> "> <td align="center" valign="middle"> <table cellspacing="2" cellpadding="0" style="border: 1px solid #000000; background-color: #FFFFFF;"> <td> <?php if (isset($_GET['picfile'])) { $picfile = $_GET['picfile']; $picname = $CONFIG['fullpath'] . $picfile; if (false !== strpos($picfile, '..')) { $picfile = 'Error'; $picname = 'images/error.gif'; } $imagesize = getimagesize($picname); echo "<a href=\"javascript:window.close();\"><img src=\"" . path2url($picname) . "\" {$imagesize['3']} class=\"image\" border=\"0\" alt=\"{$picfile}\" /></a><br />\n"; } elseif (isset($pid)) { //init.inc $pid = $_GET['pid']; $result = $db->sql_query("SELECT * from {$CONFIG['TABLE_PICTURES']} where pid='{$pid}'", false, __FILE__, __LINE__); $row = $db->sql_fetchrow($result); $pic_url = get_pic_url($row, 'fullsize'); $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"'; print '<a href="javascript:window.close();"><img src="' . $pic_url . '" ' . $geom . ' class="image" border="0" alt="' . CLICK_TO_CLOSE . '" title="' . CLICK_TO_CLOSE . '" /></a>'; } ?> </td> </table> </td> </table><!-- </a> <script language="JavaScript" type="text/javascript"> </script>-->
function theme_display_fullsize_pic() { global $CONFIG, $THEME_DIR, $FORBIDDEN_SET, $LINEBREAK, $pid; global $lang_errors, $lang_fullsize_popup, $lang_charset; $superCage = Inspekt::makeSuperCage(); if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2) { printf($lang_errors['login_needed'], '', '', '', ''); die; } elseif (USER_ID && USER_ACCESS_LEVEL <= 2) { printf($lang_errors['access_intermediate_only'], '', '', '', ''); die; } if ($superCage->get->keyExists('picfile')) { if (!GALLERY_ADMIN_MODE) { cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); } //$picfile = $_GET['picfile']; //$picfile = $superCage->get->getPath('picfile'); // doesn't work with HTML entities $matches = $superCage->get->getMatched('picfile', '/^[0-9A-Za-z~ \\/_.-]+$/'); $picfile = $matches[0]; $picname = $CONFIG['fullpath'] . $picfile; $imagesize = @getimagesize($picname); $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]); } elseif ($pid) { $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} AS p " . "WHERE pid='{$pid}' {$FORBIDDEN_SET}"; $result = cpg_db_query($sql); if (!mysql_num_rows($result)) { cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); } $row = mysql_fetch_assoc($result); if (is_image($row['filename'])) { $pic_url = get_pic_url($row, 'fullsize'); $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"'; $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom); } else { $pic_html = theme_html_picture(); if (is_movie($row['filename'])) { $mime_content = cpg_get_type($row['filename']); $ctrl_offset['mov'] = 15; $ctrl_offset['wmv'] = 45; $ctrl_offset['swf'] = 0; $ctrl_offset['rm'] = 0; $ctrl_offset_default = 45; $ctrl_height = isset($ctrl_offset[$mime_content['extension']]) ? $ctrl_offset[$mime_content['extension']] : $ctrl_offset_default; preg_match('/width="([0-9]+)".*height="([0-9]+)"/', $pic_html, $matches); $width = $matches[1] + $CONFIG['fullsize_padding_x']; $height = $matches[2] + $CONFIG['fullsize_padding_y'] + $ctrl_height; $resize_window = '<script type="text/javascript">window.resizeTo(' . $width . ', ' . $height . ')</script>'; } preg_match('/<td align="center" style="{SLIDESHOW_STYLE}">.*(.*)<\\/td>/Us', $pic_html, $matches); $pic_html = $matches[1] . $resize_window; } } if (!USER_ID && $CONFIG['allow_unlogged_access'] <= 2 || USER_ID && USER_ACCESS_LEVEL <= 2) { // adjust the size of the window if we don't have to catter for a full-size pop-up, but only a text message $row['pwidth'] = 200; $row['pheight'] = 100; } $charset = $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset']; $fullsize_html = <<<EOT <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset={$charset}" /> <title>{$CONFIG['gallery_name']}: {$lang_fullsize_popup['click_to_close']}</title> <style type="text/css"> body { margin: 0; padding: 0; background-color: gray; } img { margin:0; padding:0; border:0; } #content { margin:0 auto; padding:0; border:0; } table { border:0; width:{$row['pwidth']}px; height:{$row['pheight']}px; border-collapse:collapse} td { vertical-align: middle; text-align:center; } </style> <script type="text/javascript" src="js/jquery-1.4.2.js"></script> <script type="text/javascript" src="js/jquery.dimensions.pack.js"></script> <script type="text/javascript" src="js/displayimage.fullsize.js"></script> </head> <body style="margin:0px; padding:0px; background-color: gray;"> EOT; if ($pic_html) { $fullsize_html .= $pic_html; } else { if ($CONFIG['transparent_overlay'] == 1) { $fullsize_html .= <<<EOT <table cellpadding="0" cellspacing="0" align="center" style="padding:0px;"> <tr> EOT; $fullsize_html .= '<td align="center" valign="middle" background="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . ' class="image">'; $fullsize_html .= '<div id="content">'; $fullsize_html .= '<a href="javascript: window.close()" style="border:none"><img src="images/image.gif?id=' . floor(rand() * 1000 + rand()) . '&fullsize=yes" ' . $imagedata['geometry'] . ' alt="' . htmlspecialchars($imagedata['name']) . '" title="' . htmlspecialchars($imagedata['name']) . $LINEBREAK . $lang_fullsize_popup['click_to_close'] . '" /></a><br />' . $LINEBREAK; $fullsize_html .= <<<EOT </div> </td> </tr> </table> EOT; } else { $fullsize_html .= ' <div id="content">' . $LINEBREAK; $fullsize_html .= '<a href="javascript: window.close()"><img src="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . ' id="fullsize_image" alt="' . htmlspecialchars($imagedata['name']) . '" title="' . htmlspecialchars($imagedata['name']) . $LINEBREAK . $lang_fullsize_popup['click_to_close'] . '" /></a><br />' . $LINEBREAK . ' </div>' . $LINEBREAK; } } $fullsize_html .= <<<EOT </body> </html> EOT; $fullsize_html = CPGPluginAPI::filter('fullsize_html', $fullsize_html); echo $fullsize_html; }
function get_pic_url(&$pic_row, $mode) { global $xoopsModuleConfig, $xoopsModule; static $pic_prefix = array(); static $url_prefix = array(); if (!count($pic_prefix)) { $pic_prefix = array('thumb' => $xoopsModuleConfig['thumb_pfx'], 'normal' => $xoopsModuleConfig['normal_pfx'], 'fullsize' => ''); $url_prefix = array(0 => $xoopsModuleConfig['fullpath']); } // watermarking for JPG $ext = strrchr($pic_row['filename'], "."); if ((strtolower($ext) == ".jpg" or strtolower($ext) == ".jpeg") and $xoopsModuleConfig['watermarking']) { return XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/watermark.php?picturename=' . $url_prefix[$pic_row['url_prefix']] . path2url($pic_row['filepath'] . $pic_prefix[$mode] . $pic_row['filename']); } else { return $url_prefix[$pic_row['url_prefix']] . path2url($pic_row['filepath'] . $pic_prefix[$mode] . $pic_row['filename']); } }
function theme_display_fullsize_pic() { global $CONFIG, $THEME_DIR, $ALBUM_SET; global $lang_errors, $lang_fullsize_popup, $lang_charset; if (isset($_GET['picfile'])) { if (!GALLERY_ADMIN_MODE) { cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__); } $picfile = $_GET['picfile']; $picname = $CONFIG['fullpath'] . $picfile; $imagesize = @getimagesize($picname); $imagedata = array('name' => $picfile, 'path' => path2url($picname), 'geometry' => $imagesize[3]); } elseif (isset($_GET['pid'])) { $pid = (int) $_GET['pid']; $sql = "SELECT * " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='{$pid}' {$ALBUM_SET}"; $result = cpg_db_query($sql); if (!mysql_num_rows($result)) { cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__); } $row = mysql_fetch_array($result); $pic_url = get_pic_url($row, 'fullsize'); $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"'; $imagedata = array('name' => $row['filename'], 'path' => $pic_url, 'geometry' => $geom); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset']; ?> " /> <title><?php echo $CONFIG['gallery_name']; ?> : <?php echo $lang_fullsize_popup['click_to_close']; ?> </title> <style type="text/css"> body { margin: 0; padding: 0; background-color: gray; } img { margin:0; padding:0; border:0; } #content { margin:0 auto; padding:0; border:0; } table { border:0; width:<?php echo $row['pwidth']; ?> px; height:<?php echo $row['pheight']; ?> px; border-collapse:collapse} td { vertical-align: middle; text-align:center; } </style> <script type="text/javascript" src="scripts.js"></script> </head> <body style="margin:0px; padding:0px; background-color: gray;"> <script language="JavaScript" type="text/JavaScript"> adjust_popup(); </script> <?php if ($CONFIG['transparent_overlay'] == 1) { ?> <table cellpadding="0" cellspacing="0" align="center" style="padding:0px;"> <tr> <?php echo '<td align="center" valign="middle" background="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . ' class="image">'; echo '<div id="content">'; echo '<a href="javascript: window.close()" style="border:none"><img src="images/image.gif?id=' . floor(rand() * 1000 + rand()) . '&fullsize=yes" ' . $imagedata['geometry'] . ' alt="' . htmlspecialchars($imagedata['name']) . '" title="' . htmlspecialchars($imagedata['name']) . "\n" . $lang_fullsize_popup['click_to_close'] . '" /></a><br />' . "\n"; ?> </div> </td> </tr> </table> <?php } else { ?> <table class="fullsize"> <tr> <td> <div id="content"> <?php echo '<a href="javascript: window.close()"><img src="' . htmlspecialchars($imagedata['path']) . '" ' . $imagedata['geometry'] . 'alt="' . htmlspecialchars($imagedata['name']) . '" title="' . htmlspecialchars($imagedata['name']) . "\n" . $lang_fullsize_popup['click_to_close'] . '" /></a><br />' . "\n"; ?> </div> </td> </tr> </table> <?php } ?> </body> </html> <?php }
function display_fullsize_pic() { global $xoopsModuleConfig, $_GET, $ALBUM_SET; global $xoopsDB, $pic_out; if (isset($_GET['picfile'])) { if (!GALLERY_ADMIN_MODE) { redirect_header('index.php', 2, _MD_ACCESS_DENIED); } $picfile = $_GET['picfile']; $picname = $xoopsModuleConfig['fullpath'] . $picfile; $imagesize = @getimagesize($picname); $pic_out = "<img src=\"" . path2url($picname) . "\" {$imagesize['3']} class=\"image\" border=\"0\" alt=\"{$picfile}\"/><br />\n"; } elseif (isset($_GET['pid'])) { $pid = (int) $_GET['pid']; $sql = "SELECT * " . "FROM " . $xoopsDB->prefix("xcgal_pictures") . " " . "WHERE pid='{$pid}' {$ALBUM_SET}"; $result = $xoopsDB->query($sql); if (!$xoopsDB->getRowsNum($result)) { redirect_header('index.php', 2, _MD_NON_EXIST_AP); } $row = $xoopsDB->fetchArray($result); $pic_url = get_pic_url($row, 'fullsize'); $geom = 'width="' . $row['pwidth'] . '" height="' . $row['pheight'] . '"'; $pic_out = "<img src=\"" . $pic_url . "\" {$geom} class=\"image\" border=\"0\" alt=\"" . htmlspecialchars($row['filename']) . "\" /><br />\n"; } }