Skip to content

Commit 3ac729f

Browse files
committed
fix build error by specifying sdk_semver in cloudinary.url()
1 parent 1b90a6c commit 3ac729f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/app/photography/page.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import {
1414
import { Aperture, X } from "lucide-react";
1515
import exifr from 'exifr'
1616

17+
cloudinary.config({
18+
secure: true,
19+
});
20+
1721
export 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

3135
async 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) {
4044
async 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() {
6263
const cachedGetPhotos = unstable_cache(getPhotos)
6364

6465
const 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

6869
export default async function PhotographyPage() {

0 commit comments

Comments
 (0)