Cant figure out what's wrong with my image style generation code
The first argument should be array in the image_style_create_derivative() function, so the error is in the caller code. 


  Parameters
  
  $style: An image style array.
  
  $source: Path of the source file.
  
  $destination: Path or URI of the destination file.


https://api.drupal.org/api/drupal/modules%21image%21image.module/function/image_style_create_derivative/7.x

There is a incorrect sample in the comments at api.drupal.org.