You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think I figured out the problem for the image compression but I don't have an iphone to test it. The problem is that mobile iOS has a limit to the height and width of a canvas.
Our code right now is setting the canvas dimensions to the photo dimensions.
It seems like the iphone's photo dimensions are larger than the max limit of the canvas dimensions. To solve this issue, the width and height of the canvas needs to be set smaller. When we draw the image on to the canvas, we also need to reduce the photo dimensions. Syntax for canvas drawing is:
context.drawImage(img,sx,sy,swidth,sheight,x,y,width,height);
The code for drawing should go from :
var cvs = document.createElement("canvas");
cvs.width = source_img_obj.width;
cvs.height = source_img_obj.height;
var ctx = cvs.getContext("2d").drawImage(source_img_obj, 0, 0);
to:
var cvs = document.createElement("canvas");
// will need to figure out best dimensions to scale down to
cvs.width = 2000;
cvs.height = 2000;
var ctx = cvs.getContext("2d").drawImage(source_img_obj, 0, 0, 2000, 2000);
We need to make sure scaling down doesn't cause the image quality to suffer too much. To test this fix, I would need access to an iphone and the s3 bucket to make sure the images are compressed and uploaded correctly.
Uploading images on iPhones/iPads will work without compression, but uploading a 10MB image won't do.
The text was updated successfully, but these errors were encountered: