Changeset 12855 for trunk/picture.php


Ignore:
Timestamp:
Jan 5, 2012, 11:06:21 PM (9 years ago)
Author:
rvelices
Message:

feature 2548 multisize - improved picture.php display (original...) + code cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/picture.php

    r12798 r12855  
    163163  $selected_derivative = $element_info['derivatives'][$deriv_type];
    164164
    165   $available_derivatives = array();
     165  $unique_derivatives = array();
     166  $show_original = isset($element_info['element_url']);
    166167  $added = array();
    167168  foreach($element_info['derivatives'] as $type => $derivative)
     
    171172      continue;
    172173    $added[$url] = 1;
    173     $available_derivatives[] = $type;
    174   }
    175 
    176   global $user, $page, $template;
     174    $show_original &= !($derivative->same_as_source());
     175    $unique_derivatives[$type]= $derivative;
     176  }
     177
     178  global $page, $template;
    177179 
     180  if ($show_original)
     181  {
     182    $template->assign( 'U_ORIGINAL', $element_info['element_url'] );
     183  }
     184
    178185  $template->append('current', array(
    179186      'selected_derivative' => $selected_derivative,
    180       'available_derivative_types' => $available_derivatives,
     187      'unique_derivatives' => $unique_derivatives,
    181188    ), true);
    182189
     
    492499  }
    493500
    494 
    495 
    496   $row['derivatives'] = DerivativeImage::get_all($row);
    497   $row['src_image'] = $row['derivatives'][IMG_THUMB]->src_image;
     501  $row['src_image'] = new SrcImage($row);
     502  $row['derivatives'] = DerivativeImage::get_all($row['src_image']);
    498503 
    499   // ------ build element_path and element_url
    500   $row['element_path'] = get_element_path($row);
    501   $row['element_url'] = get_element_url($row);
    502 
    503504  if ($i=='current')
    504505  {
     506    $row['element_path'] = get_element_path($row);
     507
    505508    if ( $row['src_image']->is_original() )
    506     {
     509    {// we have a photo
    507510      if ( $user['enabled_high']=='true' )
    508511      {
    509         $row['download_url'] = get_download_url('e',$row);
     512        $row['element_url'] = $row['src_image']->get_url();
     513        $row['download_url'] = get_action_url($row['id'], 'e', true);
    510514      }
    511515    }
    512516    else
    513517    { // not a pic - need download link
    514       $row['download_url'] = $row['element_url'];
     518      $row['download_url'] = $row['element_url'] = get_element_url($row);;
    515519    }
    516520  }
Note: See TracChangeset for help on using the changeset viewer.