Project

General

Profile

« Previous | Next » 

Revision 053a92ec

Added by Andreas Kohlbecker almost 11 years ago

replacing theme_cdm_preferred_image() function by generic base functionality for all portals

View differences:

7.x/modules/cdm_dataportal/theme/cdm_dataportal.page.theme
294 294
  $taxon_profile_image_settings = variable_get(CDM_TAXON_PROFILE_IMAGE, unserialize(CDM_TAXON_PROFILE_IMAGE_DEFAULT));
295 295
  if ($taxon_profile_image_settings['show'] && !$hideImages) {
296 296

  
297
    $defaultRepresentationPart = new stdClass();
298
    if(!empty($taxon_profile_image_settings['custom_placeholder_image_on']) && !empty($taxon_profile_image_settings['custom_placeholder_image_fid'])){
299
      // use the user provided image
300
      $profile_image_file = file_load($taxon_profile_image_settings['custom_placeholder_image_fid']);
301
      $url = file_create_url($profile_image_file->uri);
302
      $image_info = image_get_info($profile_image_file->uri);
303
      $defaultRepresentationPart->width = $image_info['width'];
304
      $defaultRepresentationPart->height = $image_info['height'];
305
      $defaultRepresentationPart->uri = $url;
306
    } else {
307
      // use the hardcoded default
308
      $defaultRepresentationPart->width = 184;
309
      $defaultRepresentationPart->height = 144;
310
      $defaultRepresentationPart->uri = base_path() .  drupal_get_path('module', 'cdm_dataportal') . '/images/no_picture.png';
311
     }
312

  
313
    $out .= '<div id="taxonProfileImage">' . theme('cdm_preferredImage', array(
314
      'media' => $media,
315
      'defaultRepresentationPart' => $defaultRepresentationPart,
316
      'imageMaxExtend' => $taxon_profile_image_settings['maxextend'],
317
      )) . '</div>';
297
    $representationPart = new stdClass();
298
    $attributes = array();
299
    if (isset($media[0]->representations[0]->parts[0])) {
300
      $representationPart = $media[0]->representations[0]->parts[0];
301
      $attributes['alt'] = $representationPart->uri;
302

  
303
      if(!empty($taxon_profile_image_settings['media_uri_query'])){
304
        $representationPart->uri = $representationPart->uri
305
            . (strpos($representationPart->uri, '?') !== FALSE ? '&' : '?')
306
            . $taxon_profile_image_settings['media_uri_query'];
307
      }
308
    }
309
    else {
310
      // show placeholder image instead
311
      if(!empty($taxon_profile_image_settings['custom_placeholder_image_on']) && !empty($taxon_profile_image_settings['custom_placeholder_image_fid'])){
312
        // use the user provided image
313
        $profile_image_file = file_load($taxon_profile_image_settings['custom_placeholder_image_fid']);
314
        $url = file_create_url($profile_image_file->uri);
315
        $image_info = image_get_info($profile_image_file->uri);
316
        $representationPart->width = $image_info['width'];
317
        $representationPart->height = $image_info['height'];
318
        $representationPart->uri = $url;
319
      } else {
320
        // use the hard coded default
321
        $representationPart->width = 184;
322
        $representationPart->height = 144;
323
        $representationPart->uri = base_path() .  drupal_get_path('module', 'cdm_dataportal') . '/images/no_picture.png';
324
      }
325
      $attributes['alt'] = "no image available";
326
    }
327

  
328
    $profile_image = theme('cdm_media_gallerie_image', array(
329
        'mediaRepresentationPart' => $representationPart,
330
        'maxExtend' => $taxon_profile_image_settings['maxextend'],
331
        'addPassePartout' => FALSE,
332
        'attributes' => $attributes,
333
    ));
334
    $out .= '<div id="taxonProfileImage">' . $profile_image. '</div>';
318 335
  }
319 336

  
320 337
  // Description TOC.

Also available in: Unified diff