Below is an example of how to use the “theme_image_style ($ variables)” function to get the HTML code of an image on which a specific style is applied:
1 2 3 4 5 6 7 8 9 10 11 12 |
<?php if(!empty($field_galerie_photo['file']->uri)){ $thumbnail_galerie_photo = array( 'style_name' => 'thumbnail_galerie_photo', 'path' => isset($field_galerie_photo['file']->uri) ? $field_galerie_photo['file']->uri : '', 'width' => NULL, 'height' => NULL, ); } echo theme_image_style($thumbnail_galerie_photo); ?> |
This gives us the following result:
1 |
<img src="http://mon.exemple.com/sites/default/files/styles/thumbnail_galerie_photo/public/DSC02260.JPG?itok=y-nbkAM2" width="86" height="86" alt=""> |