From 3faa58f93196d827e1fe5b330308ee4815a8c2cb Mon Sep 17 00:00:00 2001 From: tariqksoliman Date: Wed, 18 Dec 2024 14:32:06 -0800 Subject: [PATCH] Add jpeg as a valid IMAGE_EXTENSION --- .../OpenSeadragonViewer/OpenSeadragonViewer.js | 1 + src/core/constants.js | 2 +- .../Content/Views/ProductLabel/ProductLabel.js | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/OpenSeadragonViewer/OpenSeadragonViewer.js b/src/components/OpenSeadragonViewer/OpenSeadragonViewer.js index c6a31bf..36372a3 100644 --- a/src/components/OpenSeadragonViewer/OpenSeadragonViewer.js +++ b/src/components/OpenSeadragonViewer/OpenSeadragonViewer.js @@ -192,6 +192,7 @@ const OpenSeadragonViewer = ({ image, settings, features, onLayers }) => { setSvgOverlay(so) drawFeatures(so, features) }) + console.log(image.src) viewer.open({ type: 'image', url: image.src, diff --git a/src/core/constants.js b/src/core/constants.js index 27a47b3..64e7cba 100644 --- a/src/core/constants.js +++ b/src/core/constants.js @@ -94,9 +94,9 @@ export const IMAGE_EXTENSIONS = [ 'img', 'png', 'jpg', + 'jpeg', 'vic', 'gif', - 'png', 'webp', 'tif', 'tiff', diff --git a/src/pages/Record/Content/Views/ProductLabel/ProductLabel.js b/src/pages/Record/Content/Views/ProductLabel/ProductLabel.js index 215df7b..335e0c5 100644 --- a/src/pages/Record/Content/Views/ProductLabel/ProductLabel.js +++ b/src/pages/Record/Content/Views/ProductLabel/ProductLabel.js @@ -3,8 +3,14 @@ import { useSelector, useDispatch } from 'react-redux' import PropTypes from 'prop-types' import { setSnackBarText } from '../../../../../core/redux/actions/actions' -import { getIn, getPDSUrl, isObject, copyToClipboard } from '../../../../../core/utils.js' -import { ES_PATHS } from '../../../../../core/constants.js' +import { + getIn, + getPDSUrl, + getExtension, + isObject, + copyToClipboard, +} from '../../../../../core/utils.js' +import { ES_PATHS, IMAGE_EXTENSIONS } from '../../../../../core/constants.js' import Button from '@material-ui/core/Button' import IconButton from '@material-ui/core/IconButton' @@ -428,6 +434,12 @@ const ProductLabel = (props) => { const browse_uri = getIn(recordData, ES_PATHS.browse) const imgURL = getPDSUrl(browse_uri, release_id) + let type = getExtension(imgURL, true) + if (!IMAGE_EXTENSIONS.includes(type)) { + imgURL = getPDSUrl(uri, release_id) + type = getExtension(imgURL, true) + } + const label_uri = getIn(recordData, ES_PATHS.label) const labelURL = getPDSUrl(label_uri, release_id)