Today, I'm gonna tell you how to create an image style programatically from Drupal Module. You can use this in a .install file to create the needed image style when the module is installed.

The code below will allow you to create an image style from within a module programatically:

  $style = image_style_save(array('name' => 'avatar'));
  $effect = array(
    'name' => 'image_scale',
    'data' => array(
      'width' => 64,
      'height' => 64,
      'upscale' => TRUE,
    'isid' => $style['isid'],

This code below shows how to remove the image style:


Hope this will works for you.

Drupal CMS with Free ASP.NET Hosting
Try our Drupal CMS with Free ASP.NET Hosting today and your account will be setup soon! You can also take advantage of our Windows & ASP.NET Hosting support with Unlimited Domain, Unlimited Bandwidth, Unlimited Disk Space, etc. You will not be charged a cent for trying our service for the next 3 days. Once your trial period is complete, you decide whether you'd like to continue.