Generate image styles on upload or in some other memory-conscious fashion? I have a D7 site that is hovering around 55mb on devel_shutdown(); for most uncached pages and has a lot of migrated content that has images linked to various styles around the site, many of which are currently ungenerated.

If I bump PHP memory usage allowance to 130mb (I'm on Dreamhost shared hosting, so 150mb is the top end for any individual process), images generate fine. If I leave it at the unmodified 90mb, image generation starts to fail.

It seems there are two options:

a. Get more RAM, through a virtual private server or some other hosting-related fix.

b. At my coworker's suggestion, find some fiddly way of getting images to generate ahead of a user running into them.

In terms of option B, we're using, gasp!, WordPress for an inspiration, which seems to handle images more intelligently in low-memory situations (Heresy! Madness! Spartaaaaaa!). 

To explain — after the page has loaded and PHP has released memory, thumbnails are generated as they are uploaded, noticeable when WordPress says "Crunching" during the upload process. This way, there isn't any delay when a user then views them, and there's no worry that the combined memory load of the CMS and the image library will cause one of them to fail.

Is this at all possible in Drupal? Would a module like Cache Warmer do this if set up in a cron job? Is there even any benefit to doing things this way?
I don't like the "lazy" image style generation either. After I imported 100,000 photos I batch created image styles for all of them. I just looped over each image and created the 5 or 6 styles for each image.

I noticed that there isn't a big penalty for looping over images that already have all image styles generated. So you could just run a cron, say every hour, that loops over all images created or updated within the last hour (or two to be save) and create the image styles.

I used something like this to generate the image styles, just select which ones should get generated:

    foreach(image_styles() as $style) {
        if ($style['name'] = 'thumbnail' || $style['name'] = 'medium'){
            $dest = image_style_path($style['name'], $uri);
            print ' '.$style['name']. ', ';
            if (!file_exists($dest)) {
                image_style_create_derivative($style, $uri, $dest);
            }
        }
}


You'll just need to $uri variable, in my case I get it directly from the file_managed table since I ran a batch job.