getParameter("mapurl"); $layerName = $ajaxResponse->getParameter("layerName"); $legendUrl = $ajaxResponse->getParameter("legendUrl"); $wmsId = $ajaxResponse->getParameter("wmsId"); $layerId = $ajaxResponse->getParameter("layerId"); $layerPreviewMapFileName = PREVIEW_DIR ."/".$layerId."_layer_map_preview.jpg"; $layerPreviewLegendFileName = PREVIEW_DIR ."/".$layerId."_layer_legend_preview.jpg"; if(!$mapurl){ $ajaxResponse->setSuccess(false); $ajaxResponse->setMessage('mapURL not set'); $ajaxResponse->send(); } /* if(!$legendurl){ $ajaxResponse->setSuccess(false); $ajaxResponse->setMessage('legendURL not set'); $ajaxResponse->send(); } */ if (!$wmsId) { $ajaxResponse->setSuccess(false); $ajaxResponse->setMessage('wmsId not set'); $ajaxResponse->send(); } if (!$layerName) { $ajaxResponse->setSuccess(false); $ajaxResponse->setMessage('layerName not set'); $ajaxResponse->send(); } switch ($ajaxResponse->getMethod()) { case "saveLayerPreview": $mapImg = new weldMaps2JPEG($mapurl, $layerPreviewMapFileName); if(!$mapImg) { $ajaxResponse->setSuccess(false); $ajaxResponse->setMessage('Map preview could not be created'); $ajaxResponse->send(); } if ($legendUrl) { $legendImg = new weldMaps2JPEG($legendUrl, $layerPreviewLegendFileName); if(!$legendImg) { $ajaxResponse->setSuccess(false); $ajaxResponse->setMessage('Legend preview could not be created'); $ajaxResponse->send(); } /*else { $ajaxResponse->setSuccess(true); $ajaxResponse->setMessage('Preview saved'); $ajaxResponse->send(); }*/ } else { $legendUrl = null; } $ajaxResponse->setSuccess(true); $ajaxResponse->setMessage('Preview saved'); $ajaxResponse->send(); /* $updateSQL = <<setSuccess(false); $ajaxResponse->setMessage("could not insert/Update layerPreview into db: ". pg_last_error()); }*/ break; default: $ajaxResponse->setSuccess(false); $ajaxResponse->setMessage("invalid method"); } $ajaxResponse->send(); ?>