1

I am faced with this issue that Nextjs/Image needs blurDataUrl as "data:image/jpeg..."

Previously in the Next/Image legacy you could give the blurDataUrl the url of an 10px image and it then made the blur effect.

But now it needs the image data as base64 string, I have 2 options that each one has its own problems and I cant figure out which one to choose.

Options

1- When user is uploading the image, Resize the image and save it as 10px then get its base64 string via plaiceholder pkg (ssr)

2- When user is uploading the image save the base64 of the 10px image in the database so when I load the image data from database I have the base64 string.

Note: I have converted an image and the base64 string is not that long (cause image is 10px) its something like: "sSFSDFSSsdAACsdfsDlsdfJKSKDHJLHKSHDFHLsdlkfhKJDJSLDFJKDLFHSKLDJFHSDJKLFHKSJLDFHsdfsdfskldjfhlakdfkljsldfasdfDLKF"

Problems:

1- first options needs to add yet another lib to the project and load the image and get its base64 string for images in the server(cause images are dynamic images)

2- Updating the db and saving yet another prop for images in database

What do you guys suggest? is this even correct? am I missing something? what problems might occur if I choose for example option 2?

SC K
  • 141
  • 8

0 Answers0