@@ -5,18 +5,20 @@ import { marked } from "marked";
55
66interface Props {
77 images? : any [];
8+ displayImageOnly? : boolean ;
89}
910
10- const { images } = Astro .props ;
11+ const { images, displayImageOnly } = Astro .props ;
1112const maxDimension = 256 ; // max size of preview image (256x256)
1213
1314if (images ?.length ) {
1415 await Promise .all (
1516 images .map (async (imageInfo ) => {
1617 const { default : resolvedPath } = await getAssetImagePath (imageInfo .path );
1718 const { width : originalWidth, height : originalHeight, src } = resolvedPath ;
19+ const customMax = imageInfo .maxDimension ?? maxDimension ;
1820
19- const scale = Math .min (maxDimension / originalWidth , maxDimension / originalHeight , 1 );
21+ const scale = Math .min (customMax / originalWidth , customMax / originalHeight , 1 );
2022
2123 Object .assign (imageInfo , {
2224 resolvedPath ,
@@ -31,9 +33,11 @@ if (images?.length) {
3133
3234{ images && images .length > 0 && (
3335 <div data-pagefind-ignore id = " preview-images-gallery" >
34- <h4 >Gallery</h4 >
35- <p >Click on the image to view the full preview along with the description.</p >
36-
36+ { ! displayImageOnly && (
37+ <h4 >Gallery</h4 >
38+ <p >Click on the image to view the full preview along with the description.</p >
39+ )}
40+
3741 <div class = " preview-images" >
3842 { images .map (({ src , description , resolvedPath , width , height }) => (
3943 <a href = { src } class = " glightbox" data-description = { description ? marked (description ) : " " } data-gallery = " gallery" >
0 commit comments