Image Styles Generate I am running a Drupal 7 site that does a call to an external service using Feeds Module, creates nodes from that coming JSON.  

The Feeds Module grabs an image, download it, and generate 4 different image styles. Usually in Drupal, you upload the image that goes through Imagecache, and boom the image is re-sized, why because after node_save you go to node_view that grabs a function which does the real resizing.  

In my case, i do not view the nodes, so the images does not get generated unless i run a whole view/page i created with all images so they get generated.  

I tried to curl and request the page on a time interval for the page to get generated but it seems you have to really view the page.  What would a solution for this problem be ?  

Would doing a batch operation to just view the nodes using node_view help ? What else ?

Note that on each Feeds request the site creates around 50 nodes X 4 images = 200 image.  

Help is much appreciated.
A derivative image is generated on the fly when served over HTTP. When the derivative image is requested in HTTP, if the file doesn't exists, the HTTP request is handled by Drupal. Drupal will use the image_style_deliver() page callback to generate the derivative image and deliver it. Once the image exists, Drupal will not handle the request and the file is directly delivered.

If you need to access to files externally without using HTTP to access them, you can use image_style_create_derivative($style, $source, $destination) to create the derivatives images. You will need to provide the destination path for the derivative image, which you can get with the image_style_path($style_name, $uri) function.

The following (untested) code should ensure that the derivatives for the image file identified by $fid are generated for the styles whose names are in the $styles array.

$original = file_load($fid);
foreach ($styles as $style_name) {
  $derivative_uri = image_style_path($style_name, $original-&gt;uri);
  image_style_create_derivative($style_name, $original-&gt;uri, $derivative_uri);
}