@@ -14,6 +14,10 @@ import {
1414import { Aperture , X } from "lucide-react" ;
1515import exifr from 'exifr'
1616
17+ cloudinary . config ( {
18+ secure : true ,
19+ } ) ;
20+
1721export const metadata : Metadata = {
1822 title : "Photography" ,
1923 description : "A collection of photography by myself." ,
@@ -29,7 +33,7 @@ const getBase64 = async (src: ArrayBuffer, size: number) => {
2933} ;
3034
3135async function getBlurPreviewAndMetadata ( public_id : string ) {
32- const imageUrl = cloudinary . url ( public_id , { transformation : [ { crop : 'thumb' , width : 30 } ] } )
36+ const imageUrl = cloudinary . url ( public_id , { sdk_semver : '>=2.6.1' , transformation : [ { crop : 'thumb' , width : 30 } ] } )
3337 // fetch image content and convert to data url
3438 const response = await fetch ( imageUrl ) ;
3539 const arrayBuffer = await response . arrayBuffer ( ) ;
@@ -40,9 +44,6 @@ async function getBlurPreviewAndMetadata(public_id: string) {
4044async function getPhotos ( ) {
4145 console . log ( 'Refetching photos' )
4246 try {
43- cloudinary . config ( {
44- secure : true ,
45- } ) ;
4647 const res = await cloudinary . api . resources_by_tag ( 'photography' , { resource_type : 'image' , tags : true } )
4748 return Promise . all ( res . resources . map ( async resource => {
4849 const { blurDataURL, metadata } = await getBlurPreviewAndMetadata ( resource . secure_url )
@@ -62,7 +63,7 @@ async function getPhotos() {
6263const cachedGetPhotos = unstable_cache ( getPhotos )
6364
6465const getThumbUrl = ( public_id : string ) => {
65- return cloudinary . url ( public_id , { transformation : [ { crop : 'thumb' , width : 1000 } , { quality : "auto:good" , format : 'auto' } ] } )
66+ return cloudinary . url ( public_id , { sdk_semver : '>=2.6.1' , transformation : [ { crop : 'thumb' , width : 1000 } , { quality : "auto:good" , format : 'auto' } ] } )
6667}
6768
6869export default async function PhotographyPage ( ) {
0 commit comments