public function Drupal_RichSnippets_Apachesolr_ApachesolrSchemaPreprocessor::addImage in Rich Snippets 7
Implements Drupal_RichSnippets_SchemaPreprocessorAbstract::addImage().
Overrides Drupal_RichSnippets_SchemaPreprocessorInterface::addImage
File
- lib/
Drupal/ RichSnippets/ Apachesolr/ ApachesolrSchemaPreprocessor.php, line 141 - Contains Drupal_RichSnippets_Apachesolr_ApachesolrSchemaPreprocessor.
Class
- Drupal_RichSnippets_Apachesolr_ApachesolrSchemaPreprocessor
- Rich Snippets preprocessor for the Apache Solr Search Integration module.
Code
public function addImage($schema) {
foreach ($this
->getSchemaFields($schema) as $field_name => $solr_field) {
if ($info = $this
->decodeImageInfo($field_name)) {
$attributes = array(
'src' => 'data:' . $info['mime_type'] . ';base64,' . $solr_field[0],
'height' => $info['height'],
'width' => $info['width'],
);
// @todo Make this a theme function.
$this->_variables['image'] = '<img' . drupal_attributes($attributes) . ' />';
}
}
}