def send_imageproperties_xml(req): nid, data = splitpath(req.path) if not Node.req_has_access_to_node_id(nid, u"read", req): return 404 img = get_cached_image_zoom_data(nid) req.write("""<IMAGE_PROPERTIES WIDTH="%d" HEIGHT="%d" NUMIMAGES="1" VERSION="1.8" TILESIZE="%d"/>""" % (img.width, img.height, Image.ZOOM_TILESIZE))
def send_tile(req): nid, data = splitpath(req.path) if not Node.req_has_access_to_node_id(nid, u"read", req): return 404 if not req.path.endswith(".jpg"): logg.error("invalid tile request %s", req.path) return 404 jpg = req.path[req.path.rindex("/") + 1:-4] zoom, x, y = map(int, jpg.split("-")) try: img = get_cached_image_zoom_data(nid) tile = img.get_tile(zoom, x, y) if tile is None: return 404 req.write(tile) except: logg.exception("exception in send_tile") return 500