Can I decide minimum image resolution upload criteria?

Hello Friends,

I am using a uploadcare tool for my print studio and it’s awesome.
However, I am facing issues, where end users upload very low resolution images.

So, is there any way out where we can set a minimum image resolution upload criteria?

Thanks,
Abhijit

Sure, you can do it via custom file validation
In the documentation (and below) there’s an example for maximum resolution, you can use it as base.

function maxDimensions(width, height) {
  return function(fileInfo) {
    var imageInfo = fileInfo.originalImageInfo;
    if (imageInfo !== null) {
      if (imageInfo.width > width || imageInfo.height > height) {
        throw new Error('dimensions');
      }
    }
  };
}

Hi, it seems your minimum resolution perameter doesn’t work properly. If you specify the minimum resolution to be 800x1200 the customer should be able to upload an image with a total of 960 000 pixels, however the customers length or width must match the 800x1200 requirements. For instance a customer cannot upload an image with 1200x800, or even 900x1100. It should work by the total amount of pixel data. Am I wrong about this?

@abccanvasprinting Hi, you can validate image resolution instead of image dimensions

function minResolution(width, height) {
  return function(fileInfo) {
    var imageInfo = fileInfo.originalImageInfo;
    var resolution = width * height;
    if (imageInfo !== null) {
      if (imageInfo.width * imageInfo.height < resolution) {
        throw new Error('resolution');
      }
    }
  };
} 
widget.validators.push(minResolution(800, 1200));

In this case, a user will have to upload an image with the exact resolution of 960000 pixels regardless of what dimensions it has.