Index: trunk/kernel/units/images/image_tag_processor.php =================================================================== diff -u -N -r8687 -r8705 --- trunk/kernel/units/images/image_tag_processor.php (.../image_tag_processor.php) (revision 8687) +++ trunk/kernel/units/images/image_tag_processor.php (.../image_tag_processor.php) (revision 8705) @@ -48,6 +48,7 @@ function LoadItemImage($params) { $parent_item =& $this->Application->recallObject($params['PrefixSpecial']); + /* @var $parent_item kCatDBItem */ $object =& $this->Application->recallObject($this->getPrefixSpecial(), null, Array('skip_autoload' => true)); /* @var $object kDBItem */ @@ -88,7 +89,7 @@ elseif (getArrayValue($params, 'field')) { // by virtual field name in main object $field_options = $parent_item->GetFieldOptions($params['field']); - $keys['Name'] = $field_options['original_field']; + $keys['Name'] = isset($field_options['original_field']) ? $field_options['original_field'] : $params['field']; } elseif ($image_id) { // by ID @@ -100,6 +101,29 @@ } $object->Load($keys); + + if (isset($params['field'])) { + $image_src = $parent_item->GetDBField($params['field']); + + // when image is uploaded to virtual field in main item, but not saved to db + $object->SetDBField('ThumbPath', $image_src); + + if (!$object->isLoaded()) { + // set fields for displaing new image during main item suggestion with errors + $fields_hash = Array ( + 'Url' => '', + 'ThumbUrl' => '', + 'LocalPath' => '', + + 'SameImages' => 1, + 'LocalThumb' => 1, + 'LocalImage' => 1, + ); + + $object->SetDBFieldsFromHash($fields_hash); + $object->Loaded = true; + } + } } }