UBB doesn't have the ability to check a user posted image for size, whether file size or height/width. Adding this code would slow down your board to an unacceptable degree and would be needlessly complex.
If your users are posting overly large images, tell them not to inline them, but to link to them. If they refuse to comply, remove their posting permissions. 'Tis quite easier than trying to hack...