I ended up creating a separate content type and a theme template file that solved this specific problem I had. I will update this if I ever find a way to do this in a module or other.
EDIT:
I ended up creating a module that solves this.
in hook_menu:
function mymodule_menu () {
$items['node/%/generateimages'] = array (
'title' => 'Generate images',
'page callback' => 'mymodule_generate_images',
'page arguments' => array(0, 1),
'access callback' => TRUE,
);
}
In the callback function:
function mymodule_generate_images ($arg1, $arg2) {
$retval = '';
$path = drupal_lookup_path ("source", $arg1 . '/' . $arg2);
$node = menu_get_object ("node", 1, $path);
drupal_set_title ('Generate images ' . $node->title);
global $language;
$lang = $language->language;
$files = field_get_items ('node', $node, 'field_image');
foreach ($files as $key => $media) :
$url = image_style_url ('related_thumbnail', $media['uri']);
$thumb = theme ('image_style', array('style_name' => 'related_thumbnail', 'path' => $media['uri']));
$retval .= $thumb;
endforeach;
return $retval;
}
After node creation, I manually have to go to thenodeurl/generateimages and images defined in the callback function is created.
I wish someone could tell me a better way to solve this :)