async function processAndSavePhoto(uploadedImage) {
  // Random File name to be saved
  const savedFileName = `${uuid.v1()}.jpg`;

  // Ensure the uploads path exists
  await fs.ensureDir(imageUploadPath);

  // Process image
  const finalImage = sharp(uploadedImage.data);

  // Save image
  await finalImage.toFile(path.join(imageUploadPath, savedFileName));

  return savedFileName;
}
// Save a photo and get filename
Save a photo and get filename
Save a photo and get filename
async function processAndSavePhoto(uploadedImage) {
  const savedFileName = `${uuid.v1()}.jpg`;
  await fs.ensureDir(imageUploadPath);
  const finalImage = sharp(uploadedImage.data);
  await finalImage.toFile(path.join(imageUploadPath, savedFileName));
  return savedFileName;
}
async function processAndSavePhoto ( uploadedImage ) { const savedFileName = ` ${ uuid . v1 ( ) } ` ; await fs . ensureDir ( imageUploadPath ) ; const finalImage = sharp ( uploadedImage . data ) ; await finalImage . toFile ( path . join ( imageUploadPath , savedFileName ) ) ; return savedFileName ; }
Save a photo and get filename
Save a photo and get filename
// Random File name to be saved // Ensure the uploads path exists // Process image // Save image