converter.thumbnailResizeFailureDetector Property HTML5/Flash Uploader JavaScript

Supported technologies:

Configures how the uploader tries to detect whether image resizing failed due to memory issues and whether to retry.


JavaScript Initialize
    converters : [
            //...other params...
            thumbnailResizeFailureDetector: 0,
            //...other params...
Get/Set Value at Runtime
value = $au.imageUploaderFlash('uploaderID').converters().get(index).thumbnailResizeFailureDetector();

Property Value

Type: Number

If 0 (default), it won't attempt to detect failures and do anything about it. If you set a larger value, it will be a number of attempts to create an image.

Default value is 0.


Under certain circumstances, a browser may fail to process an image (e.g. resize it). For example, it may happen if the system runs out of memory. Unfortunately, JavaScript does not give any means to handle this situation gracefully. It will just silently fail and return a blank image. As a result, you will observe an empty black image.

This property gives you an opportunity to handle this situation. For example:

  • Keep trying. Set this value to, say, 10. If some image is blank after resize, the uploader will try to resize the image again. If the image is blank again, it will try one more time - until the number of attempts reach the amount you have specified.
  • Fallback to the source image. Set this value to, say, 1, and add a second converter to mode, e.g. *=Thumbnail;SourceFile. In this case, if the image is blank, it will notice the failure and switch to a fallback converter (SourceFile).

To speed things up, the algorithm does not check 100% of pixels. It breaks the image into a grid and selects certain pixels based on this grid. It works great with photos, but if you are uploading images with large amount of transparent pixels, it may produce false positives. Be careful!

If necessary, you may fine-tune the algorithm. To do it, instead of a number, pass the following JSON:

	step : 10, 		// grid size
	topPadding : 0, 	// offset from the top in percent
	leftPadding : 0, 	// offset from the left border in percent
	rightPadding : 0,	// offset from the right border in percent
	bottomPadding : 0,	// offset from the bottom in percent
	attemptCount : 0 	// the number you would pass to this param normally

See Also