get("mb_print_urls") containing the mapRequests * expects Mapbender::session()->get("mb_print_resolution") * **/ require(dirname(__FILE__)."/../php/mb_validateSession.php"); class weldMaps{ var $map_width; var $map_height; var $integrateURL; var $matching; var $pattern; var $replacement; function weldMaps($map_urls, $factor){ #{ file | false } #$debug_file = LOG_DIR."/print.log"; $debug_file = false; settype($factor, "integer"); if($debug_file){ $debug = fopen($debug_file,"a") ; fputs($debug, str_repeat("-",50) . chr(13). chr(10). date("d.m.y, H:i:s") . " Open debug-file: " . chr(13). chr(10)); for($i=0; $iintegrateURL = $integrateURL; $this->matching = $matching; $this->pattern = $pattern; $this->replacement = $replacement; if(preg_match("/width=(\d*)/i", $map_urls[0], $matches)){ $this->map_width = round(intval($matches[1]) * intval($factor) * floatval($deformation)); } if(preg_match("/height=(\d*)/i", $map_urls[0], $matches)){ $this->map_height = round(intval($matches[1]) * intval($factor) * floatval($deformation)); } for($i=0; $ichangeResolution($map_urls[$i], $factor); if($debug_file){ $debug = fopen($debug_file,"a") ; fputs($debug, "transformated: " . chr(13). chr(10)); fputs($debug, $i . " ". $my_urls[$i] . chr(13). chr(10)); fclose($debug); } } $image = imagecreate($this->map_width, $this->map_height); $white = ImageColorAllocate($image,255,255,255); ImageFilledRectangle($image,0,0,$this->map_width,$this->map_height,$white); for($i = 0; $iloadpng($my_urls[$i]); imagecopy($image, $im, 0, 0, 0, 0, $this->map_width, $this->map_height); } ImagePNG($image); ImageDestroy($image); } function loadpng ($imgname) { $im = @ImageCreateFromPNG ($imgname); if (!$im) { $im = ImageCreate ($this->map_width, $this->map_height); $bgc = ImageColorAllocate ($im, 255, 255, 255); $tc = ImageColorAllocate ($im, 0, 0, 0); ImageFilledRectangle ($im, 0, 0, $map_width, $map_height, $bgc); ImageString($im, 1, 5, 5, "Fehler beim �ffnen von: ", $tc); $chunk = chunk_split(urldecode($imgname), 60, "###"); $array_chunk = explode("###", $chunk); for($i=0; $iintegrateURL == true){ $tc = ImageColorAllocate ($im, 0, 0, 0); ImageString($im, 1, 5, 5, $imgname, $tc); } return $im; } function changeResolution($map_url,$factor){ $newResolution = preg_replace("/width=\d*/i", "WIDTH=" . $this->map_width, $map_url); $newResolution = preg_replace("/height=\d*/i", "HEIGHT=" . $this->map_height, $newResolution); if($this->matching == true && $factor > 1){ $newResolution = preg_replace($this->pattern, $this->replacement, $newResolution); } return $newResolution; } } $map_urls = explode("###",Mapbender::session()->get("mb_print_url")); $output = new weldMaps($map_urls, Mapbender::session()->get("mb_print_resolution")); ?>