src/Creation/ImageItemFactory.php
public function createResize(BType $resizeType, array $data, $cap = false)
    {
        if($resizeType->getName() !== 'resize')
        {
            throw new ImageAggrException('Попытка создания ресайза с типом не равным resize ('.$resizeType->getName().')!');
        }

        $fields  = $this->collectionFactory->createFieldsCollection();
        $owns    = $this->collectionFactory->createOwnsCollection();
        $refs    = $this->collectionFactory->createRefsCollection();

        $resizeItem = new ResizeItem($resizeType, $fields, $owns, $refs, $cap);

        $metaName       = $resizeType->getOwn('name');
        $metaLink       = $resizeType->getOwn('link');
        $metaAlt        = $resizeType->getOwn('alt');
        $metaCacheIndex = $resizeType->getOwn('cache_index');
        $metaWidth      = $resizeType->getOwn('width');
        $metaHeight     = $resizeType->getOwn('height');

        $metaOriginal   = $resizeType->getRef('original');

        //Собственные поля
        $fieldName       = $this->createLocalCField($resizeItem, $metaName,       $this->checkAndGetData($data, 'name', 'string'));
        $fieldLink       = $this->createLocalCField($resizeItem, $metaLink,       $this->checkAndGetData($data, 'link', 'string'));
        $fieldAlt        = $this->createLocalCField($resizeItem, $metaAlt,        $this->checkAndGetData($data, 'alt', 'string'));
        $fieldCacheIndex = $this->createLocalCField($resizeItem, $metaCacheIndex, $this->checkAndGetData($data, 'cache_index', 'integer'));
        $fieldWidth      = $this->createLocalCField($resizeItem, $metaWidth,      $this->checkAndGetData($data, 'width', 'integer'));
        $fieldHeight     = $this->createLocalCField($resizeItem, $metaHeight,     $this->checkAndGetData($data, 'height', 'integer'));

        //Ссылки
        $resizeItem->setOwn($fieldName);   $resizeItem->setField($fieldName);
        $resizeItem->setOwn($fieldLink);   $resizeItem->setField($fieldLink);
        $resizeItem->setOwn($fieldAlt);    $resizeItem->setField($fieldAlt);
        $resizeItem->setOwn($fieldCacheIndex); $resizeItem->setField($fieldCacheIndex);
        $resizeItem->setOwn($fieldWidth);  $resizeItem->setField($fieldWidth);
        $resizeItem->setOwn($fieldHeight); $resizeItem->setField($fieldHeight);

        //Ссылки
        $originalRef = new OriginalRefField($resizeItem, $metaOriginal);

        $resizeItem->setRef($originalRef); $resizeItem->setField($originalRef);

        return $resizeItem;
    }
public function createResize(BType $resizeType, array $data, $cap = false)
    {
        if($resizeType->getName() !== 'resize')
        {
            throw new ImageAggrException('Попытка создания ресайза с типом не равным resize ('.$resizeType->getName().')!');
        }

        $fields  = $this->collectionFactory->createFieldsCollection();
        $owns    = $this->collectionFactory->createOwnsCollection();
        $refs    = $this->collectionFactory->createRefsCollection();

        $resizeItem = new ResizeItem($resizeType, $fields, $owns, $refs, $cap);

        $metaName       = $resizeType->getOwn('name');
        $metaLink       = $resizeType->getOwn('link');
        $metaAlt        = $resizeType->getOwn('alt');
        $metaCacheIndex = $resizeType->getOwn('cache_index');
        $metaWidth      = $resizeType->getOwn('width');
        $metaHeight     = $resizeType->getOwn('height');

        $metaOriginal   = $resizeType->getRef('original');

        //Собственные поля
        $fieldName       = $this->createLocalCField($resizeItem, $metaName,       $this->checkAndGetData($data, 'name', 'string'));
        $fieldLink       = $this->createLocalCField($resizeItem, $metaLink,       $this->checkAndGetData($data, 'link', 'string'));
        $fieldAlt        = $this->createLocalCField($resizeItem, $metaAlt,        $this->checkAndGetData($data, 'alt', 'string'));
        $fieldCacheIndex = $this->createLocalCField($resizeItem, $metaCacheIndex, $this->checkAndGetData($data, 'cache_index', 'integer'));
        $fieldWidth      = $this->createLocalCField($resizeItem, $metaWidth,      $this->checkAndGetData($data, 'width', 'integer'));
        $fieldHeight     = $this->createLocalCField($resizeItem, $metaHeight,     $this->checkAndGetData($data, 'height', 'integer'));

        //Ссылки
        $resizeItem->setOwn($fieldName);   $resizeItem->setField($fieldName);
        $resizeItem->setOwn($fieldLink);   $resizeItem->setField($fieldLink);
        $resizeItem->setOwn($fieldAlt);    $resizeItem->setField($fieldAlt);
        $resizeItem->setOwn($fieldCacheIndex); $resizeItem->setField($fieldCacheIndex);
        $resizeItem->setOwn($fieldWidth);  $resizeItem->setField($fieldWidth);
        $resizeItem->setOwn($fieldHeight); $resizeItem->setField($fieldHeight);

        //Ссылки
        $originalRef = new OriginalRefField($resizeItem, $metaOriginal);

        $resizeItem->setRef($originalRef); $resizeItem->setField($originalRef);

        return $resizeItem;
    }
@param \Interpro\Core\Contracts\Taxonomy\Types\BType $type
@param array $data
@param bool $cap

@return \Interpro\ImageAggr\Items\ResizeItem