Skip to content

Commit

Permalink
fix: PDF fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dbirman committed Dec 11, 2024
1 parent 770353c commit eb500e7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/aind_qc_portal/panel/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,10 @@ def panel(self):


def _is_image(reference):
return reference.endswith(".png") or reference.endswith(".jpg") or reference.endswith(".gif") or reference.endswith(".jpeg") or reference.endswith(".svg") or reference.endswith(".pdf")
return reference.endswith(".png") or reference.endswith(".jpg") or reference.endswith(".gif") or reference.endswith(".jpeg") or reference.endswith(".svg")

def _is_pdf(reference):
return reference.endswith(".pdf")

def _get_s3_file(url, ext):
try:
Expand Down Expand Up @@ -216,6 +218,8 @@ def _parse_type(reference, data):

if _is_image(reference):
return pn.pane.Image(data, sizing_mode="scale_width", max_width=1200)
elif _is_pdf(reference):
return pn.pane.PDF(data, sizing_mode="scale_width", max_width=1200, height=1000)
elif reference.endswith(".mp4"):
# Return the Video pane using the temporary file
return pn.pane.Video(
Expand Down

0 comments on commit eb500e7

Please sign in to comment.