This only happens with some images right? The images that are having the problem are to large to be resized.
In most cases, setting the memory limit using ini_set should give the script enough memory to process larger images, but in your server configuration this is not working, you will need to work with the host to increase the available emory for your site, or if they won't increase that, use smaller images to begin with.