Get image style url in field template (Drupal 7)

Error message

The specified file temporary://fileDGeFHi could not be copied, because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions. More information is available in the system log.

We have got certain image style url in field--image.tpl.php template for implement fancybox gallery. We need link to different size image as a wrapper for this image thumbnail.

Example:

<a href="style/large/image.jpg"><image src="style/thumb/image.jpg" /></a>

Solution (put to field--image.tpl.php "foreach ($items AS $item)" loop):

$item['#path']['path'] = file_create_url(image_style_path('large', $item['#item']['uri']));
Rating: 
10 out of 10 based on 1 ratings.
Tags: