drupal theming - Difference between THEME_preprocess_image and THEME_image ? -


what difference between these 2 functions can put in template.php drupal?

function theme_preprocess_image(&$variables) {     // }  function theme_image($variables) {     // } 

function theme_image renders html output renderable array.

theme_preprocess_image

i believe, right name template_preprocess_hook, called inside of theme() before theme function eg. theme_image

please consider use case here:

// in custom.module      $variables = array(    'path' => 'path/to/img.jpg',    'alt' => 'test alt',   'title' => 'test title',   'width' => '50%',   'height' => '50%',   'attributes' => array('class' => 'some-img', 'id' => 'my-img'),   ); $img = theme('image', $variables); 

if want change attributes of image, following:

function mytheme_preprocess_image($vars) {     // changes, before it's rendered. } 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -