Image (Database) Update Fails - Limits exceeded

I need to store an image associated with a database row. I have decided to store it in the row itself with an ‘Image (Database)’ field rather than use ‘Image (filename)’.

All the settings in the php.ini have been set accordingly, but the update to the DB fails.

After looking at the mysql log I found the issue was ‘max_allowed_packet’ was set too low in my.cnf.

There’s no issue raising these values to a level that will most likely work 95% of the time. But what if I do not want the user to upload images greater than 5MB. Is there anyway I can check the size of an image once it has been selected/uploadef by the user, before the update occurs (like during onValidate), OR set the max file size in SC somewhere so that I can prevent the problem in the first place, rather than the user receiving some nasty technical message after they click save?

There does not appear to be a FileSize field option when using Image (Database).