You are here

public function Drupal_RichSnippets_Apachesolr_ApachesolrSchemaPreprocessor::decodeImageInfo in Rich Snippets 7

Helper function that decodes the image info from the corresponding field.

Parameters

stirng $field_name: The name of the field containing the image data.

Return value

array|FALSE An array of image info matching what is returned from image_get_info(), FALSE if the data is not available.

1 call to Drupal_RichSnippets_Apachesolr_ApachesolrSchemaPreprocessor::decodeImageInfo()
Drupal_RichSnippets_Apachesolr_ApachesolrSchemaPreprocessor::addImage in lib/Drupal/RichSnippets/Apachesolr/ApachesolrSchemaPreprocessor.php
Implements Drupal_RichSnippets_SchemaPreprocessorAbstract::addImage().

File

lib/Drupal/RichSnippets/Apachesolr/ApachesolrSchemaPreprocessor.php, line 107
Contains Drupal_RichSnippets_Apachesolr_ApachesolrSchemaPreprocessor.

Class

Drupal_RichSnippets_Apachesolr_ApachesolrSchemaPreprocessor
Rich Snippets preprocessor for the Apache Solr Search Integration module.

Code

public function decodeImageInfo($field_name) {
  $info = FALSE;
  $info_field_name = rich_snippets_get_apachesolr_image_info_field($field_name);
  if (!empty($this->_solrFields[$info_field_name])) {
    if ($info = drupal_json_decode($this->_solrFields[$info_field_name][0])) {
      $info += array(
        'width' => 0,
        'height' => 0,
        'extension' => '',
        'mime_type' => '',
        'file_size' => 0,
      );
    }
  }
  return $info;
}