MediaModel example


    public function create(array $params)
    {
        $this->checkPrivilege('create');

        $params = $this->prepareMediaData($params);

        $media = new MediaModel();
        $media->fromArray($params);
        $attribute = new MediaAttribute();

        if (isset($params['attribute']) && \is_array($params['attribute'])) {
            $attribute->fromArray($params['attribute']);
        }
        $media->setAttribute($attribute);

        $path = $this->prepareFilePath($media->getPath()$media->getFileName());
        $media->setPath($path);

        
Home | Imprint | This part of the site doesn't use cookies.