如何使用 Fine-Uploader 确定图像是否可以在当前浏览器中预览?
How to determine if an image is previewable in current browser with Fine-Uploader?
目标是生成 thumbnails/previews 服务器端 只有 如果它不能在客户端完成。
Fine-Uploader documentation 状态:
However, you should take care to not blindly return a thumbnailUrl
for
images that are already previewable in modern browsers unless your
server intends to orient them correctly first.
服务端如何知道Fine-Uploader能否生成预览客户端?
在发送文件上传请求之前无法可靠地确定特定预览是否已成功生成,因为预览生成是一个异步过程,可能会在请求已发送。但是,您可以通过检查 imagePreviews
feature flag. If qq.supportedFeatures.imagePreviews
is true
, then the current browser is capable of generating client-side image previews. If this flag is false
you can set a parameter with all upload requests 指示您的服务器 return 来确定当前浏览器是否能够生成图像预览图片预览 URL 代替。例如,您可以设置参数选项来执行此操作:
request: {
params: isBrowserPreviewPossible: qq.supportedFeatures.imagePreviews
}
带值的 isBrowserPreviewPossible
参数将随每个上传请求一起发送到您的服务器。这是demonstrated in the live S3 uploader at FineUploader.com。
目标是生成 thumbnails/previews 服务器端 只有 如果它不能在客户端完成。
Fine-Uploader documentation 状态:
However, you should take care to not blindly return a
thumbnailUrl
for images that are already previewable in modern browsers unless your server intends to orient them correctly first.
服务端如何知道Fine-Uploader能否生成预览客户端?
在发送文件上传请求之前无法可靠地确定特定预览是否已成功生成,因为预览生成是一个异步过程,可能会在请求已发送。但是,您可以通过检查 imagePreviews
feature flag. If qq.supportedFeatures.imagePreviews
is true
, then the current browser is capable of generating client-side image previews. If this flag is false
you can set a parameter with all upload requests 指示您的服务器 return 来确定当前浏览器是否能够生成图像预览图片预览 URL 代替。例如,您可以设置参数选项来执行此操作:
request: {
params: isBrowserPreviewPossible: qq.supportedFeatures.imagePreviews
}
带值的 isBrowserPreviewPossible
参数将随每个上传请求一起发送到您的服务器。这是demonstrated in the live S3 uploader at FineUploader.com。