2

I need to create image style programmatically in Drupal 7. I found this issue: https://www.drupal.org/project/drupal/issues/2735969 and much more other issues, but all are for Drupal 8. I can't find anything to Drupal 7. Is that impossible in Drupal 7?

2

1 Answer 1

1

You're looking for the image_style_save and image_effect_save functions.

An example from the comments on the image_style_save docs page:

$style = image_style_save(array('name' => 'avatar'));
$effect = array(
  'name' => 'image_scale',
  'data' => array(
    'width' => 64,
    'height' => 64,
    'upscale' => TRUE,
  ), 
  'isid' => $style['isid'],
);
image_effect_save($effect);
1
  • That's what I need. Thank you! :)
    – oneindige
    Aug 12, 2020 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.