Submitted by Jan on
<?php /** drupal 7 **/ $presetname = '800x421'; //presetname $src = $image->uri; $dst = image_style_path($presetname, $src); //create image uri if(!file_exists($dst)) { image_style_create_derivative(image_style_load($presetname), $src, $dst)); // create imagecache } /** drupal 6 **/ $presetname = '800x421'; $preset = imagecache_preset_by_name($presetname); $src = $image["filepath"]; $dst = imagecache_create_path($presetname, $src); if(!file_exists($dst)) { imagecache_build_derivative($preset['actions'], $src, $dst)) ; } ?>
- Log in to post comments