get("REQUEST")); //$e = new mb_exception(strtoupper($obj1->get("REQUEST"))); //$e = new mb_exception("count url: ".count($url)); if ($request !== "GETMAP" && $request !== "GETLEGENDGRAPHIC") { //no width or height exists - e.g. legend graphics //$e = new mb_exception("No GetMap or GetLegendGraphic"); //$e = new mb_exception("class_welsMaps2JPEG.php: ".$url[0]); if ($url[0] != false){ $url[0] = urldecode($url[0]); //$e = new mb_exception("class_weldMaps2JPEG.php: ".$url[0]); //list($width, $height, $type, $attr) = getimagesizefromstring($this->loadpng($url[0])); $img = $this->loadpng($url[0]); $width = imagesx($img); $height = imagesy($img); //list($width, $height, $type, $attr) = getimagesize($img); //$width = 200; //$height = 200; $image = imagecreatetruecolor($width, $height); $white = ImageColorAllocate($image,255,255,255); ImageFilledRectangle($image,0,0,$width,$height,$white); imagecopy($image, $img, 0, 0, 0, 0, $width, $height); //free space @imagedestroy($img); imagejpeg($image,$filename); //free space imagedestroy($image); return true; } } else { $width = $obj1->get("width"); $height = $obj1->get("height"); if (!$width || $width == '' || !$height || $height == '') { $e = new mb_exception("classes/class_weldMaps2JPEG.php: Paremeters width and/or height are not given in $request request! Try to get it from image size."); if ($url[0] != false){ $url[0] = urldecode($url[0]); //$e = new mb_exception("class_weldMaps2JPEG.php: ".$url[0]); //list($width, $height, $type, $attr) = getimagesizefromstring($this->loadpng($url[0])); $img = $this->loadpng($url[0]); $width = imagesx($img); $height = imagesy($img); } } } $image = imagecreatetruecolor($width, $height); $white = ImageColorAllocate($image,255,255,255); ImageFilledRectangle($image,0,0,$width,$height,$white); for($i=0; $isetPNG(); $url[$i] = $obj->encodeGET($encode); $img = $this->loadpng($url[$i]); if($img != false){ imagecopy($image, $img, 0, 0, 0, 0, $width, $height); @imagedestroy($img); } else{ $e = new mb_exception("weldMaps2JPEG: unable to load image: " . $url[$i]); } } } imagejpeg($image,$filename); imagedestroy($image); } /** * Old constructor to keep PHP downward compatibility */ function weldMaps2JPEG($urls,$filename, $encode = true){ self::__construct($urls,$filename, $encode); } function loadpng ($imgurl) { $obj = new stripRequest($imgurl); $x = new connector(); //set header //$x->set("curlSendCustomHeaders",true); //$e = new mb_exception($x->file); //$x->set("curlSendCustomHeaders",false); // //Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 //Accept-Encoding gzip, deflate //Accept-Language de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 //Cache-Control max-age=0 //Connection keep-alive //Host geodaten-luwg.rlp.de //User-Agent Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:25.0) Gecko/20100101 Firefox/25.0 //$headers = array( // "GET: ".$path." HTTP/1.1", // "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:25.0) Gecko/20100101 Firefox/25.0", // "Accept-Encoding: gzip, deflate", // "Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3", // "Host: geodaten-luwg.rlp.de", // "Cache-Control: max-age=0", // "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", // "Connection: Keep-Alive" //); //$x->set("curlSendCustomHeaders",true); //$x->set("externalHeaders", $headers); //$f = $obj->get("format"); //$e = new mb_exception($imgurl); $im = imagecreatefromstring($x->load($imgurl)); if(!$im){ $im = false; $e = new mb_exception("weldMaps2JPEG: loadpng: unable to load image: ".$imgurl); } return $im; } } ?>