image style not applied porgrammatically I create below function to create image style programmatically 

function imh_get_image_from_uri($image_uri, $style) {
    $derivative_uri = image_style_path($style, $image_uri);
    $success = file_exists($derivative_uri) || image_style_create_derivative($style, $image_uri, $derivative_uri);
    $new_image_url = file_create_url($derivative_uri);
    return theme_image(array('path' =&gt; $new_image_url));
}


and call in my tpl with

 imh_get_image_from_uri($node-&gt;field_cast_image['und'][0]['uri'],'215x317');


and  a example of image created path is

http://mydomain.com/sites/default/files/styles/215x317/public/Hugh%20Jackman-2.jpg

I check the images style , as expamle this image image style  set  to scale 215 * 317,every thing seems work good but when I see image directly I see the image in this path not resized ( I call my function with another image style but also they are not resize or scale or ....) ,
The images that use build-in drupal image style work correctly but when I use top function to load image style programmatically the image style action (resize, scale ,... ) not applied, the image create on that path but noting applied on it.

where is problem?

update
Also I try

$build = array(
  '#theme' =&gt; 'image_style',
  '#path' =&gt; $image_uri,
  '#style_name' =&gt; $style,
    );
return render($build);


output
&lt;img src="http://mydomain.com/sites/default/files/styles/215x317/public/Hugh%20Jackman-2.jpg?itok=PcP0uFjT" width="215" height="317"&gt;

but the problem exists yet, the file in the image path exists but not resized.
it seems change it by style ( not resized main image)
The solution is 

  return  theme('image_style',array('style_name' =&gt; $style, 'path' =&gt; $image_uri));


but this not work first because the image style for that file created before , first I should remove it then try this  ;)