Might help: ezoe generates image sizes for preview on demand, the code is a bit complex:
http://svn.ez.no/svn/extensions/eztinymce/trunk/ezoe/modules/ezoe/load.php
using ezoeajaxcontent.php: http://svn.ez.no/svn/extensions/eztinymce/trunk/ezoe/classes/ezoeajaxcontent.php
related code (last line in foreach is the one triggering the image generation):
It can also generate xml if you want to (if you use soap or xslt), and there are some more advance stuff in the ezcore extension if you need more ajax features( see http://projects.ez.no/ezcore ).
Just in case someone has also problems to use this code:
Make sure you add the ContentClass which has the image attribute you want use to the AvailableImageDataTypes[] under block [ImageDataTypeSettings] settings in site.ini: