Skip to content

Commit

Permalink
avniproject/avni-etl#79 | Fix single file download from carousel
Browse files Browse the repository at this point in the history
  • Loading branch information
1t5j0y committed Nov 21, 2023
1 parent 8d16423 commit 5af36f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/components/ImageCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const ImageCarousel = ({
index
) => (
<div key={index}>
<img src={getImage(img)} className="carousel-image"/>
<img src={getImage(img, true)} className="carousel-image"/>
<div className="checkbox">
<CheckButton
image_url={getImage(img)}
Expand Down
8 changes: 3 additions & 5 deletions client/model/ImageType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ const getLowestLocation = function (address: string, minLevelName: string) {
return JSON.parse(address)[minLevelName];
}

export const getThumbnail = function(image: imageType) {
return isAudioOrVideo(image.url) ? PlayMediaThumbnail : image.signedThumbnailUrl
}

export const getMetadata = function(img: imageType) : imageMetadata {
return {
entityId: img.entityId,
Expand All @@ -53,10 +49,12 @@ export const getMetadata = function(img: imageType) : imageMetadata {
}

export const getImage = function(image: imageType, getThumbnail: boolean = false) {
if (!getThumbnail) return image.signedUrl;

const fileExtension = image.url.substring(image.url.lastIndexOf(".")).toLowerCase();

if (isImage(fileExtension)) {
return getThumbnail ? image.signedThumbnailUrl : image.signedUrl;
return image.signedThumbnailUrl;
}
if (isAudioOrVideo(fileExtension)) {
return PlayMediaThumbnail;
Expand Down

0 comments on commit 5af36f1

Please sign in to comment.