-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Allow an alternate library to be used to generate resized images #1576
Conversation
Enabled for all operations that result in a resized image, such as drawing a preview thumbnail and generating a scaled image blob for upload. Still need to investigate orientation consequences. #1525
I have this mostly working at this point. Even though I have some more tasks to complete before calling this "done", it's certainly ready for someone to attempt to test out their favorite resize library alongside Fine Uploader. If anyone is interested in being a tester for this feature, please let me know. Of course, you will also be able to influence the feature before it is completed. |
Core code on this feature is now complete. However, I'm unable to come up with a way to fix large image subsampling in iOS and still make use of one of the suggested third-party image resize libraries. I'm not sure this is even possible, or at least something that can be accomplished without integrating this complex logic into one of the third-party resize libraries. However, Fine Uploader will be able to properly orient all images before passing them off to a third-party resizer. On iOS, the internal resize/scaling code should be used instead of a third-party image resize plug-in. Documentation will include a way to easily implement this behavior. |
Also fixed the scaleImage method docs. #1576
Great work. I'm ready to test if needed. I'm not targeting iOS, only desktop browsers though. |
Should be ready to test now. I've updated some docs, but not all (see the checkboxes in the pull request description for more details). Assuming you are using pica (and not supporting iOS), want to use pica both for resizing displayed thumbnails and for resizing images to be uploaded, your Fine Uploader initialization code will look like this: var uploader = new qq.FineUploader({
element: document.getElementById("uploader"),
request: {
endpoint: "/upload/endpoint"
},
thumbnails: {
customResizer: function(resizeInfo) {
return new Promise(function(resolve, reject) {
pica.resizeCanvas(resizeInfo.sourceCanvas, resizeInfo.targetCanvas, {}, resolve)
})
},
placeholders: {
waitingPath: "/client/placeholders/waiting-generic.png",
notAvailablePath: "/client/placeholders/not_available-generic.png"
}
},
scaling: {
customResizer: function(resizeInfo) {
return new Promise(function(resolve, reject) {
pica.resizeCanvas(resizeInfo.sourceCanvas, resizeInfo.targetCanvas, {}, resolve)
})
},
sizes: [...]
}
}) The |
@keyeh Have you had a chance to verify on your end? I'm hoping to finish updating the docs and get this out the door within a week. |
This is ready to be released, and I plan on pushing out Fine Uploader 5.10.0 tomorrow unless I hear back from anyone regarding issue or requested changes. |
customResizer
function (if provided). Support API methods too.closes #1525