// All rights reserved. This script is part of PHPWCMS. The PHPWCMS web content management system is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html A copy is found in the textfile GPL.txt and important notices to the license from the author is found in LICENSE.txt distributed with these scripts. This script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. This copyright notice MUST APPEAR in all copies of the script! *************************************************************************************/ // ---------------------------------------------------------------- // obligate check for phpwcms constants if (!defined('PHPWCMS_ROOT')) { die("You Cannot Access This Script Directly, Have a Nice Day."); } // ---------------------------------------------------------------- // image rendering functions // moved away from front function imagetable(& $phpwcms, & $image, $rand="0:0:0:0", $align=0) { // creates the image tags if text w/image // 0 :1 :2 :3 :4 :5 :6 :7 :8 // dbid:filename:hash:extension:width:height:caption:position:zoom $cnt_image_lightbox = empty($GLOBALS['cnt_image_lightbox']) ? 0 : 1; $crop = empty($image['crop']) ? 0 : 1; $thumb_image = get_cached_image( array( "target_ext" => $image[3], "image_name" => $image[2] . '.' . $image[3], "max_width" => $image[4], "max_height" => $image[5], "thumb_name" => md5($image[2].$image[4].$image[5].$phpwcms["sharpen_level"].$crop), 'crop_image' => $crop ) ); if($image[8]) { $zoominfo = get_cached_image( array( "target_ext" => $image[3], "image_name" => $image[2] . '.' . $image[3], "max_width" => $phpwcms["img_prev_width"], "max_height" => $phpwcms["img_prev_height"], "thumb_name" => md5($image[2].$phpwcms["img_prev_width"].$phpwcms["img_prev_height"].$phpwcms["sharpen_level"]) ) ); if($zoominfo == false) $image[8] = 0; } $table = ''; if($thumb_image != false) { // read content image info $table_class = $GLOBALS["template_default"]["article"]["image_table_class"]; $table_class = ($table_class) ? ' class="'.$table_class.'"' : ''; $table_bgcolor = $GLOBALS["template_default"]["article"]["image_table_bgcolor"]; $table_bgcolor = ($table_bgcolor) ? ' bgcolor="'.$table_bgcolor.'"' : ''; $image_align = $GLOBALS["template_default"]["article"]["image_align"]; $image_align = ($image_align) ? ' align="'.$image_align.'"' : ''; $image_valign = $GLOBALS["template_default"]["article"]["image_valign"]; $image_valign = ($image_valign) ? ' valign="'.$image_valign.'"' : ''; $image_border = ' border="'.intval($GLOBALS["template_default"]["article"]["image_border"]).'"'; $image_imgclass = $GLOBALS["template_default"]["article"]["image_imgclass"]; $image_imgclass = ($image_imgclass) ? ' class="'.$image_imgclass.'"' : ''; $image_class = $GLOBALS["template_default"]["article"]["image_class"]; $image_class = ($image_class) ? ' class="'.$image_class.'"' : ''; $image_bgcolor = $GLOBALS["template_default"]["article"]["image_bgcolor"]; $image_bgcolor = ($image_bgcolor) ? ' bgcolor="'.$image_bgcolor.'"' : ''; $caption_class = $GLOBALS["template_default"]["article"]["image_caption_class"]; $caption_class = ($caption_class) ? ' class="'.$caption_class.'"' : ''; $caption_bgcolor= $GLOBALS["template_default"]["article"]["image_caption_bgcolor"]; $caption_bgcolor= ($caption_bgcolor) ? ' bgcolor="'.$caption_bgcolor.'"' : ''; $caption_valign = $GLOBALS["template_default"]["article"]["image_caption_valign"]; $caption_valign = ($caption_valign) ? ' valign="'.$caption_valign.'"' : ''; $caption_align = $GLOBALS["template_default"]["article"]["image_caption_align"]; $caption_align = ($caption_align) ? ' align="'.$caption_align.'"' : ''; $capt_before = $GLOBALS["template_default"]["article"]["image_caption_before"]; $capt_after = $GLOBALS["template_default"]["article"]["image_caption_after"]; // image caption //$caption = explode('|', base64_decode($image[6])); $caption = getImageCaption(base64_decode($image[6])); $caption[0] = html_specialchars($caption[0]); $caption[3] = empty($caption[3]) ? '' : ' title="'.html_specialchars($caption[3]).'"'; //title $caption[1] = empty($caption[1]) ? html_specialchars($image[1]) : html_specialchars($caption[1]); // image source $img = ''.$caption[1].''; $tablewidth = $thumb_image[1]; // spaces around image table $rand = explode(":", $rand); if(is_array($rand) && count($rand)) { foreach($rand as $key => $value) { $rand[$key] = intval($value); } } else { $rand = array(0,0,0,0); } if($rand[2] && $rand[3]) { $colspan = ' colspan="3"'; } else { if($rand[2] || $rand[3]) { $colspan = ' colspan="2"'; } else { $colspan = ''; } } $tablewidth += $rand[2] + $rand[3]; $table .= '\n"; $table .= ($rand[0]) ? ''.spacer(1,$rand[0])."\n" : ''; $table .= ''; $table .= ($rand[2]) ? '' : ''; if($image[8]) { $open_popup_link = 'image_zoom.php?'.getClickZoomImageParameter($zoominfo[0].'?'.$zoominfo[3]); $table .= '"; if($caption[2][0]) { $open_link = $caption[2][0]; $return_false = ''; } else { $open_link = $open_popup_link; $return_false = 'return false;'; } if(!$cnt_image_lightbox || $caption[2][0]) { $table .= ""; } else { $table .= ''; } else { $table .= '"; if($caption[2][0]) { $table .= ''.$img.''; } else { $table .= $img; } $table .= ''; } $table .= ($rand[3]) ? "" : ""; $table .= "\n"; if($caption[0] && empty($image['nocaption'])) { $table .= ""; $table .= ($rand[2]) ? "" : ""; $table .= ''.$capt_before.$caption[0]; if($caption[4] !== '') { $table .= ' '.html_specialchars($caption[4]).''; } $table .= $capt_after.""; $table .= ($rand[3]) ? "" : ""; $table .= "\n"; } $table .= ($rand[1]) ? "".spacer(1,$rand[1])."\n" : ""; $table .= "
'.spacer($rand[2],1).'".spacer($rand[3],1)."
".spacer($rand[2],1)."".spacer($rand[3],1)."
"; } return $table; } function imagediv(& $phpwcms, & $image, $classname='') { // creates the image tags if text w/image // 0 :1 :2 :3 :4 :5 :6 :7 :8 // dbid:filename:hash:extension:width:height:caption:position:zoom $cnt_image_lightbox = empty($GLOBALS['cnt_image_lightbox']) ? 0 : 1; $crop = empty($image['crop']) ? 0 : 1; $classname = 'imgDIV'.$classname; $thumb_image = get_cached_image( array( "target_ext" => $image[3], "image_name" => $image[2] . '.' . $image[3], "max_width" => $image[4], "max_height" => $image[5], "thumb_name" => md5($image[2].$image[4].$image[5].$phpwcms["sharpen_level"].$crop), 'crop_image' => $crop ) ); if($image[8]) { $zoominfo = get_cached_image( array( "target_ext" => $image[3], "image_name" => $image[2] . '.' . $image[3], "max_width" => $phpwcms["img_prev_width"], "max_height" => $phpwcms["img_prev_height"], "thumb_name" => md5($image[2].$phpwcms["img_prev_width"].$phpwcms["img_prev_height"].$phpwcms["sharpen_level"]) ) ); if($zoominfo == false) $image[8] = 0; } $image_block = ''; if($thumb_image != false) { // read content image info $image_border = ' border="'.intval($GLOBALS["template_default"]["article"]["image_border"]).'"'; $image_imgclass = $GLOBALS["template_default"]["article"]["image_imgclass"]; $image_imgclass = ($image_imgclass) ? ' class="'.$image_imgclass.'"' : ''; $image_class = $GLOBALS["template_default"]["article"]["image_class"]; $image_class = ($image_class) ? ' class="'.$image_class.'"' : ' class="imgClass"'; $caption_class = $GLOBALS["template_default"]["article"]["image_caption_class"]; $caption_class = ($caption_class) ? ' class="'.$caption_class.'"' : ' class="caption"'; $capt_before = $GLOBALS["template_default"]["article"]["image_caption_before"]; $capt_after = $GLOBALS["template_default"]["article"]["image_caption_after"]; // image caption $caption = getImageCaption(base64_decode($image[6])); $caption[0] = html_specialchars($caption[0]); $caption[3] = empty($caption[3]) ? '' : ' title="'.html_specialchars($caption[3]).'"'; //title $caption[1] = empty($caption[1]) ? html_specialchars($image[1]) : html_specialchars($caption[1]); // image source $img = ''.$caption[1].''; $image_block .= '
'; if($image[8]) { $open_popup_link = 'image_zoom.php?'.getClickZoomImageParameter($zoominfo[0].'?'.$zoominfo[3]); $image_block .= '"; if($caption[2][0]) { $open_link = $caption[2][0]; $return_false = ''; } else { $open_link = $open_popup_link; $return_false = 'return false;'; } if(!$cnt_image_lightbox || $caption[2][0]) { $image_block .= '"; } else { $image_block .= '
'; } else { $image_block .= '"; if($caption[2][0]) { $image_block .= ''.$img.''; } else { $image_block .= $img; } $image_block .= ''; } if($caption[0] && empty($image['nocaption'])) { $image_block .= ''.$capt_before.$caption[0]; if($caption[4] !== '') { $image_block .= ' '.html_specialchars($caption[4]).''; } $image_block .= $capt_after."

"; } $image_block .= ""; } return $image_block; } function imagelisttable($imagelist, $rand="0:0:0:0", $align=0, $type=0) { // build imagelist or ecard chooser table // image: type = 0 // ecard: type = 1 $template_type = (!$type) ? 'imagelist' : 'ecard'; if(empty($GLOBALS['cnt_image_lightbox'])) { $lightbox = 0; } else { $lightbox = generic_string(5); } $caption_on = empty($imagelist['nocaption']) ? true : false; $crop = empty($imagelist['crop']) ? 0 : 1; $table_class = $GLOBALS["template_default"]["article"][$template_type."_table_class"]; if($align) { $table_class .= ' imgListTable'.ucfirst($align); } $table_class = trim($table_class); if($table_class) { $table_class = ' class="'.$table_class.'"'; } $table_bgcolor = $GLOBALS["template_default"]["article"][$template_type."_table_bgcolor"]; $table_bgcolor = ($table_bgcolor) ? ' bgcolor="'.$table_bgcolor.'"' : ''; $image_align = $GLOBALS["template_default"]["article"][$template_type."_align"]; $image_align = ($image_align) ? ' align="'.$image_align.'"' : ''; $image_valign = $GLOBALS["template_default"]["article"][$template_type."_valign"]; $image_valign = ($image_valign) ? ' valign="'.$image_valign.'"' : ''; $image_border = ' border="'.intval($GLOBALS["template_default"]["article"][$template_type."_border"]).'"'; $image_imgclass = $GLOBALS["template_default"]["article"][$template_type."_imgclass"]; $image_imgclass = ($image_imgclass) ? ' class="'.$image_imgclass.'"' : ''; $image_class = $GLOBALS["template_default"]["article"][$template_type."_class"]; $image_class = ($image_class) ? ' class="'.$image_class.'"' : ''; $image_bgcolor = $GLOBALS["template_default"]["article"][$template_type."_bgcolor"]; $image_bgcolor = ($image_bgcolor) ? ' bgcolor="'.$image_bgcolor.'"' : ''; $caption_class = $GLOBALS["template_default"]["article"][$template_type."_caption_class"]; $caption_class = ($caption_class) ? ' class="'.$caption_class.'"' : ''; $caption_bgcolor= $GLOBALS["template_default"]["article"][$template_type."_caption_bgcolor"]; $caption_bgcolor= ($caption_bgcolor) ? ' bgcolor="'.$caption_bgcolor.'"' : ''; $caption_valign = $GLOBALS["template_default"]["article"][$template_type."_caption_valign"]; $caption_valign = ($caption_valign) ? ' valign="'.$caption_valign.'"' : ''; $caption_align = $GLOBALS["template_default"]["article"][$template_type."_caption_align"]; $caption_align = ($caption_align) ? ' align="'.$caption_align.'"' : ''; $capt_before = $GLOBALS["template_default"]["article"][$template_type."_caption_before"]; $capt_after = $GLOBALS["template_default"]["article"][$template_type."_caption_after"]; $align = (!$align) ? '' : ' align="'.$align.'"'; $rand = explode(":", $rand); if(count($rand)) { foreach($rand as $key => $value) { $rand[$key] = intval($value); } } else { $rand = array(0,0,0,0); } $col_rand = ($rand[2] && $rand[3]) ? 2 : (($rand[2] || $rand[3]) ? 1 : 0 ); if(($count_images = count($imagelist['images']))) { // randomize image if(!empty($imagelist['random'])) { shuffle($imagelist['images']); } if(empty($imagelist['limit'])) { $imagelist['limit'] = 0; } //Tabelle starten $table = LF.''.LF; $x=0; $y=0; $z=0; foreach($imagelist['images'] as $key => $value) { $y++; if($z && $x==1) { if($col_space) { $table .= LF.''.LF.' 1)?" colspan=\"".$col_total."\"":""); if(!empty($GLOBALS["template_default"]['article']['imagelist_spacerrow_class'])) { $table .= ' class="'.$GLOBALS["template_default"]['article']['imagelist_spacerrow_class'].'">'; $table .= spacer(1,1).''.LF.''.LF; } else { $table .= '>'.spacer(1,$col_space).''.LF.''.LF; } } } if(!$x) { //Some default values $col_space = $imagelist['space']; //Space between images $col_count = $imagelist['col']; //columns $col_total = $col_count + (($col_space)?($col_count-1):(0)) + $col_rand; //Wenn oberer Rand definiert if($rand[0]) { $table .= ''.LF.' 1)?' colspan="'.$col_total.'"':'').'>'.spacer(1,$rand[0]).''.LF.''.LF; } $x=1; } if($x==1) { // if left border $table_tmp = ($rand[2]) ? ' '.LF : ''; //Neue Tabellenzeile $capt_tmp = ''; $capt_row = ''.LF.$table_tmp; if($caption_on) { $table .= $capt_row; } else { $table .= ''.LF; } } //Aktuelle Bildspalte ausgeben $table .= ' '; //width="'.$imagelist[$key]["w"].'" removed because no centered image possible $thumb_image = get_cached_image( array( "target_ext" => $imagelist['images'][$key][3], "image_name" => $imagelist['images'][$key][2] . '.' . $imagelist['images'][$key][3], "max_width" => $imagelist['images'][$key][4], "max_height" => $imagelist['images'][$key][5], "thumb_name" => md5( $imagelist['images'][$key][2].$imagelist['images'][$key][4]. $imagelist['images'][$key][5].$GLOBALS['phpwcms']["sharpen_level"].$crop), 'crop_image' => $crop ) ); if($imagelist['zoom']) { $zoominfo = get_cached_image( array( "target_ext" => $imagelist['images'][$key][3], "image_name" => $imagelist['images'][$key][2] . '.' . $imagelist['images'][$key][3], "max_width" => $GLOBALS['phpwcms']["img_prev_width"], "max_height" => $GLOBALS['phpwcms']["img_prev_height"], "thumb_name" => md5( $imagelist['images'][$key][2].$GLOBALS['phpwcms']["img_prev_width"]. $GLOBALS['phpwcms']["img_prev_height"].$GLOBALS['phpwcms']["sharpen_level"] ) ) ); } // now try to build caption and if neccessary add alt to image or set external link for image $caption = getImageCaption($imagelist['images'][$key][6]); // set caption and ALT Image Text for imagelist $capt_cur = !$type ? html_specialchars($caption[0]) : $caption[0]; $caption[3] = empty($caption[3]) ? '' : ' title="'.html_specialchars($caption[3]).'"'; //title $caption[1] = empty($caption[1]) ? html_specialchars($imagelist['images'][$key][1]) : html_specialchars($caption[1]); $list_img_temp = ''; if($imagelist['zoom'] && isset($zoominfo) && $zoominfo != false) { // if click enlarge the image $open_popup_link = 'image_zoom.php?'.getClickZoomImageParameter($zoominfo[0].'?'.$zoominfo[3]); if($caption[2][0]) { $open_link = $caption[2][0]; $return_false = ''; } else { $open_link = $open_popup_link; $return_false = 'return false;'; } if(!$lightbox || $caption[2][0]) { $table .= "'; } else { // lightbox $table .= '"; } else { // if not click enlarge if($caption[2][0]) { $table .= ''.$list_img_temp.''; } else { $table .= $list_img_temp; } } $table .= ''.LF; $capt_tmp .= $capt_cur; $capt_row .= ' '.$capt_before.$capt_cur.$capt_after.''.LF; //Gegenchecken wieviele Tabellenspalten als Rest bleiben und ergänzen if($y == $count_images && $col_count > 1) { //wenn eigentlich alle Bilder durchlaufen sind if ($col_space && $x<$col_count) { $xct = ' '.LF; $table .= $xct; $capt_row .= $xct; } $rest_image = (ceil($count_images / $col_count) * $col_count) - $count_images; for ($i=1; $i <= $rest_image; $i++) { $table .= ' '; $capt_row .= ' '; if($i < $rest_image) { if($col_space) { $xct = ' '.LF; $table .= $xct; $capt_row .= $xct; } } $x++; } } if($x==$col_count) { //Wenn maximale Anzahl Bildspalten erreicht $xct = ($rand[3]) ? ''.LF : ''; $table .= $xct; $capt_row .= $xct; $table .= "".LF; $capt_row .= "".LF; if($capt_tmp) { if($caption_on) { $table .= $capt_row; } $capt_row = ''; $capt_tmp = ''; } $x=1; $z++; } else { $xct = ($col_space) ? ' '.LF : ''; $table .= $xct; $capt_row .= $xct; $x++; } // end if max image count if($imagelist['limit'] == $y) { break; } } if($rand[1]) { $table .= ''.LF.' 1)?" colspan=\"".$col_total."\"":"").">".spacer(1,$rand[1]).''.LF.''.LF; } $table .= '
'.spacer($rand[2],1).'
'.spacer($col_space,1).'  '.spacer($col_space,1).''.spacer($rand[3],1).'
'.spacer($col_space,1).'
'.LF; } return $table; } ?>