Created
October 4, 2012 15:22
-
-
Save soulston/3834348 to your computer and use it in GitHub Desktop.
Drupal 7 load an image from a field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$image = field_get_items('node', $node, 'my_field_name')) { | |
// current is just a quick way to get the first item in the array - you would probably array_pop here or just call | |
// $image = $image[0]; | |
$image = current($image); | |
$image_uri = $image['uri']; | |
// Run the image through image styles. | |
$image = image_style_path('profile-small', $image_uri); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment