PHPackages                             halyang92/form-media - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. halyang92/form-media

ActiveLibrary

halyang92/form-media
====================

Dcat-admin image/video input extension.

030JavaScript

Since Sep 2Pushed 4y ago1 watchersCompare

[ Source](https://github.com/halyang92/form-media)[ Packagist](https://packagist.org/packages/halyang92/form-media)[ RSS](/packages/halyang92-form-media/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Dcat-admin 表单媒体拓展
=================

[](#dcat-admin-表单媒体拓展)

预览
--

[](#预览)

### 表单

[](#表单)

[![form](https://user-images.githubusercontent.com/24578855/105875109-5aa30400-6038-11eb-9b5c-1c833e0c6b92.jpg)](https://user-images.githubusercontent.com/24578855/105875109-5aa30400-6038-11eb-9b5c-1c833e0c6b92.jpg)

### 动态表单

[](#动态表单)

[![form-array](https://user-images.githubusercontent.com/24578855/100456207-f24caa80-30fa-11eb-86a3-a8e3d2102655.jpg)](https://user-images.githubusercontent.com/24578855/100456207-f24caa80-30fa-11eb-86a3-a8e3d2102655.jpg)

### 弹出选择框

[](#弹出选择框)

[![form-modal](https://user-images.githubusercontent.com/24578855/104125985-1277b680-5395-11eb-835b-c20e7c7585f9.jpg)](https://user-images.githubusercontent.com/24578855/104125985-1277b680-5395-11eb-835b-c20e7c7585f9.jpg)

环境
--

[](#环境)

- PHP &gt;= 7.2.5
- Dcat-admin ^2.0

安装
--

[](#安装)

### composer 安装

[](#composer-安装)

```
composer require halyang92/form-media

```

### 安装扩展

[](#安装扩展)

在 `开发工具->扩展` 安装本扩展

使用
--

[](#使用)

#### 单图 数据库结构 varchar

[](#单图-数据库结构-varchar)

##### 可删除

[](#可删除)

```
$form->photo('photo','图片')
    ->nametype('datetime')
    ->remove(true)
    ->help('单图，可删除');

```

##### 不可删除

[](#不可删除)

```
$form->photo('photo','图片')
    ->path('pic')
    ->nametype('uniqid')
    ->remove(false)
    ->help('单图，不可删除');

$form->photo('photo','图片')
    ->nametype('uniqid')
    ->help('单图，不可删除');

```

#### 多图 数据库结构 json

[](#多图-数据库结构-json)

```
$form->photos('photo', '图片')
    ->path('pic')
    ->pageSize(16)
    ->nametype('uniqid')
    ->limit(9)
    ->remove(true);  //可删除

```

#### 视频 数据库结构 json/varchar

[](#视频-数据库结构-jsonvarchar)

```
$form->video('video','视频')
    ->path('video')
    ->nametype('uniqid')
    ->remove(true);  //可删除

```

### 参数说明

[](#参数说明)

```
path(string)    ： 快速定位目录，默认为根目录
nametype(string)： 文件重命名方式 uniqid|datetime，默认 uniqid
pageSize(string)： 弹出层列表每页显示数量
limit(int)      ： 限制条数
remove(boolean) :  是否有删除按钮
textField(boolean) : 是否开启文本字段 ，默认关闭

photo 、 photos 、 video  的 参数默认值不一样

photo  默认 limit = 1  remove = false

photos 默认 limit = 99  remove = true

video  默认 limit = 1  remove = true

```

##### 多图上传提交的数据为 json 字符串，如需输出数组，请在对应模型中加入下面代码

[](#多图上传提交的数据为-json-字符串如需输出数组请在对应模型中加入下面代码)

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Demo extends Model
{

    public function getPicturesAttribute($pictures)
    {

        return json_decode($pictures, true);

    }

}

```

特别鸣谢
----

[](#特别鸣谢)

感谢 `detail` 提供的原始代码

```
https://github.com/deatil/dcat-form-media

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/fca480e55b0b192ae97863ceb6b2ac43c919500a3c1348c3ed34d962469acd47?d=identicon)[halyang92](/maintainers/halyang92)

---

Top Contributors

[![halyang92](https://avatars.githubusercontent.com/u/51880440?v=4)](https://github.com/halyang92 "halyang92 (13 commits)")

### Embed Badge

![Health badge](/badges/halyang92-form-media/health.svg)

```
[![Health](https://phpackages.com/badges/halyang92-form-media/health.svg)](https://phpackages.com/packages/halyang92-form-media)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
