eye4web/zfc-user-profile-picture

为 ZfcUser 添加个人头像功能。

0.0.1 2015-03-07 22:05 UTC

This package is not auto-updated.

Last update: 2024-09-14 16:13:38 UTC


README

Build Status Test Coverage Code Climate Latest Stable Version License

介绍

本模块为 ZfcUser 添加了个人头像上传功能。

安装

使用 composer

  1. 将此项目添加到 composer.json 文件中

    "require": {
        "eye4web/zfc-user-profile-picture": "dev-master"
    }
  2. 现在运行以下命令让 composer 下载模块

    $ php composer.phar update
  3. 在您的 application.config.php 文件中启用它。

    <?php
    return array(
        'modules' => array(
            // ...
            'Eye4web\ZfcUser\ProfilePicture'
        ),
        // ...
    );
  4. config/eye4web.zfcuser.profilepicture.global.php.dist 复制到 config/autoload/eye4web.zfcuser.profilepicture.global.php 并根据您的需求进行配置。

  5. 确保您的用户实体实现了 Eye4web\ZfcUser\ProfilePicture\Entity\ProfilePictureInterface 接口。

    use Eye4web\ZfcUser\ProfilePicture\Entity\ProfilePictureInterface;
    use ZfcUser\Entity\UserInterface;
    
    class User implements ProfilePictureInterface, UserInterface
    {
        // ...
        protected $profile_picture;
    
        public function getProfilePicture()
        {
            return $this->profile_picture;
        }
    
        public function setProfilePicture($path)
        {
            $this->profile_picture = $path;
        }
    }
  6. 确保您已安装 libmagic 和 fileinfo php 扩展。