Index: trunk/kernel/units/images/image_tag_processor.php =================================================================== diff -u -N -r8686 -r8687 --- trunk/kernel/units/images/image_tag_processor.php (.../image_tag_processor.php) (revision 8686) +++ trunk/kernel/units/images/image_tag_processor.php (.../image_tag_processor.php) (revision 8687) @@ -56,13 +56,14 @@ // if we need primary thumbnail which is preloaded with category item's list $is_primary = $this->SelectParam($params, 'primary,Primary'); + $image_id = $this->Application->GetVar($this->Prefix.'_id'); if ( - ($is_primary || !isset($params['name'])) - && - !$this->Application->GetVar('img_id') - && - isset($parent_item->Fields['LocalThumb']) + // is primary, when primary mark set OR name & field not given + ($is_primary || !(isset($params['name']) || isset($params['field']))) && + + // primary image is preloaded AND direct id not given + isset($parent_item->Fields['ThumbPath']) && !$image_id ) { $object->SetDefaultValues(); $object->SetDBField('Url', $parent_item->GetDBField('FullUrl')); @@ -76,21 +77,26 @@ $keys[$id_field] = $parent_item->GetDBField($parent_table_key); // which image to load? - if ( getArrayValue($params, 'Primary') ) { //load primary image + if ($is_primary) { + // by PrimaryImage mark $keys['DefaultImg'] = 1; } - elseif ( getArrayValue($params, 'name') ) { //load by name + elseif (getArrayValue($params, 'name')) { + // by ImageName $keys['Name'] = $params['name']; } - elseif ( getArrayValue($params, 'field') ) { //load by virtual field name in main object + elseif (getArrayValue($params, 'field')) { + // by virtual field name in main object $field_options = $parent_item->GetFieldOptions($params['field']); $keys['Name'] = $field_options['original_field']; } - elseif ( $image_id = $this->Application->GetVar($this->Prefix.'_id') ) { + elseif ($image_id) { + // by ID $keys['ImageId'] = $image_id; } else { - $keys['DefaultImg'] = 1; //if primary was not set explicity and name was also not passed - load primary + // by PrimaryImage if no other criteria given + $keys['DefaultImg'] = 1; } $object->Load($keys);