Don't know about your script, but i found i needed 45Mb to upload, resize and create a thumbnail for a 2mb image.
most isp's won't let you edit php.ini, mine won't, hence the ini_set method.
it doesn't affect php ini, but it does give you more memory
try increasing to 100mb and try a file which fails at 64mb and see what you get
<?php ini_set("memory_limit","100M"); ?>