diff --git a/ifcbdb/dashboard/urls.py b/ifcbdb/dashboard/urls.py index 5e9d481d..ad3e835a 100644 --- a/ifcbdb/dashboard/urls.py +++ b/ifcbdb/dashboard/urls.py @@ -99,6 +99,9 @@ def to_url(self, value): path('/_.png', views.image_png_legacy, name='image_png_legacy'), path('/_.jpg', views.image_jpg_legacy, name='image_jpg_legacy'), + # legacy blob access + path('/__blob.png', views.image_blob_legacy, name='image_blob_legacy'), + # legacy feed API path('/api/feed//start//end/', views.feed_legacy, name='feed_legacy'), diff --git a/ifcbdb/dashboard/views.py b/ifcbdb/dashboard/views.py index 97aab275..c8c5ff84 100644 --- a/ifcbdb/dashboard/views.py +++ b/ifcbdb/dashboard/views.py @@ -541,6 +541,18 @@ def image_data(request, bin_id, target): }) +def image_blob_legacy(request, bin_id, target, dataset_name): + bin, _ = bin_in_dataset_or_404(bin_id, dataset_name) + try: + arr = bin.blob(int(target)) if bin.has_blobs() else None + except KeyError: + raise Http404(f"blob data not found for target {target} in bin {bin_id}") + if arr is None: + raise Http404(f"bin {bin_id} has no associated blob data") + png_data = format_image(arr, 'image/png') + return HttpResponse(png_data, content_type='image/png') + + def image_blob(request, bin_id, target): bin = get_object_or_404(Bin, pid=bin_id) blob = embed_image(bin.blob(int(target))) if bin.has_blobs() else None