Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ifcbdb/dashboard/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ def to_url(self, value):
path('<slug:dataset_name>/<slug:bin_id>_<int:target>.png', views.image_png_legacy, name='image_png_legacy'),
path('<slug:dataset_name>/<slug:bin_id>_<int:target>.jpg', views.image_jpg_legacy, name='image_jpg_legacy'),

# legacy blob access
path('<slug:dataset_name>/<slug:bin_id>_<int:target>_blob.png', views.image_blob_legacy, name='image_blob_legacy'),

# legacy feed API
path('<ds_plus_tags>/api/feed/<slug:metric>/start/<start>/end/<end>', views.feed_legacy, name='feed_legacy'),

Expand Down
12 changes: 12 additions & 0 deletions ifcbdb/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down