Skip to content

Commit

Permalink
Add jpeg as a valid IMAGE_EXTENSION
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman committed Dec 18, 2024
1 parent 50a9b3f commit 3faa58f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/OpenSeadragonViewer/OpenSeadragonViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/core/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ export const IMAGE_EXTENSIONS = [
'img',
'png',
'jpg',
'jpeg',
'vic',
'gif',
'png',
'webp',
'tif',
'tiff',
Expand Down
16 changes: 14 additions & 2 deletions src/pages/Record/Content/Views/ProductLabel/ProductLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 3faa58f

Please sign in to comment.