code: function exifRotate(img) {
    const exif = img._exif;
  
    if (exif && exif.tags && exif.tags.Orientation) {
      switch (img._exif.tags.Orientation) {
        case 1: // Horizontal (normal)
          // do nothing
          break;
        case 2: // Mirror horizontal
          img.mirror(true, false);
          break;
        case 3: // Rotate 180
          img.rotate(180, false);
          break;
        case 4: // Mirror vertical
          img.mirror(false, true);
          break;
        case 5: // Mirror horizontal and rotate 270 CW
          img.rotate(-90, false).mirror(true, false);
          break;
        case 6: // Rotate 90 CW
          img.rotate(-90, false);
          break;
        case 7: // Mirror horizontal and rotate 90 CW
          img.rotate(90, false).mirror(true, false);
          break;
        case 8: // Rotate 270 CW
          img.rotate(-270, false);
          break;
        default:
          break;
      }
    }
  
    return img;
  }
docs: /*
  Automagically rotates an image based on its EXIF data (if present)
  @param img a constants object