def get_derivative(filename, region, size, rotation, quality): filepath = image_path_finder.main(filename) quality, format = quality.split(".") with tempfile.TemporaryDirectory() as tmpdirname: try: shutil.copy(filepath, tmpdirname) except: abort(404) newPath = tmpdirname + "/" + filename + ".jpg" proceed, path_or_error = image_changer.main(newPath, region, size, rotation, quality, format) if proceed: if format in mimetypes: return send_file(path_or_error, mimetype=mimetypes[format]) else: abort(400, description="File format is unacceptable") else: print("NOW PRINTING ERROR MESSGAGE") print(path_or_error) abort(400, description=path_or_error)
def get_info(filename): filepath = image_path_finder.main(filename) info = image_info_finder.main(filename, filepath) # info = json.dumps(info) return jsonify(info)
def get_image(filename): """Provides the original image without the IIIF wrapping""" filename = image_path_finder.main(filename) return send_file(filename, mimetype="image/jpg")