I want to save locally to the server, a styled version of an image attached to a node. "Styled" as in filtered through a custom image style that I have already configured. What is the correct function, I can't find it anywhere.

I have file_unmanaged_copy() of the original image working fine, I can't see how to retrieve a styled version.


theme_image_style. Imagecache is replaced by image style in Drupal 7. Example:

print theme('image_style',array('style_name' => 'thumbnail', 'path' => 'path/to/image'));
  • I saw this one, and since it returns HTML, and I only wanted the image, I thought it wasn't the right one. If I need to use this and then extract the image from it, I can do that, although that sounds a little inelegant.
    – ezrock
    Sep 15 '12 at 20:07

image_style_url() ended up being the closest match to what I was looking for. It doesn't include the full html markup for the image, so I didn't need to do any additional work to get to it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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