I need to create and apply image style based on the height and width provided by user. So what I did is, I created image style using Drupal core UI (http://mysite.com/admin/config/media/image-styles/add). I also added scale effect to it. After that I can see the style directory created under [path]/sites/default/files/styles/mystyle
Now programmatically I updated the effect (width and height) and flushed the image style. But after executing my code, its removing the created style directory (mystyle) and nothing happening.
$style = image_style_load('mystyle');
$isid = $style['isid']; db_delete('image_effects') //deleting existing effect ->condition('isid', $isid, '=') ->execute(); $effect = array( // creating new effect 'name' => 'image_scale', 'data' => array( 'width' => $width, 'height' => $height, 'upscale' => FALSE, ), 'isid' => $isid, ); image_effect_save($effect); $output = image_style_url('mystyle', $uri); image_style_flush($style);
I'm getting Drupal access denied page when I try to access the return value of image_style_url. what am I missing?