Round-tripping the image to canvas (as we do for resizing) is the easiest way to remove meta-data. So one solution is to simply resize all images rather than just those that exceed limits. This is probably a reasonable thing to do as most camera images are unnecessarily big for web rendering.
One exception would be gifs as converting them via canvas breaks the animation.
We cannot use the same approach for videos though which will almost certainly require server side processing (which we already need to do ideally to transcode to ubiquitous format).
This is done for images, but could still be an issue for video. There is no easy way to deal with this on the client. For video it could and should be done as part of transcoding (which we also should be doing).
Round-tripping the image to canvas (as we do for resizing) is the easiest way to remove meta-data. So one solution is to simply resize all images rather than just those that exceed limits. This is probably a reasonable thing to do as most camera images are unnecessarily big for web rendering.
One exception would be gifs as converting them via canvas breaks the animation.
We cannot use the same approach for videos though which will almost certainly require server side processing (which we already need to do ideally to transcode to ubiquitous format).