buse974 / dms
适用于ZF3的文档管理系统
Requires
- php: >=5.4
- php-ffmpeg/php-ffmpeg: ~0.5
- zendframework/zend-config: *
- zendframework/zend-file: 2.4.9
- zendframework/zend-i18n: *
- zendframework/zend-loader: *
- zendframework/zend-log: *
- zendframework/zend-modulemanager: *
- zendframework/zend-mvc: *
- zendframework/zend-serializer: *
- zendframework/zend-servicemanager: *
- zendframework/zend-view: *
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-16 00:50:53 UTC
README
适用于ZF2的文档管理系统
描述
DMS允许您管理Zend Framework 2的文档。
安装
先决条件
在安装DMS模块之前,请确保您的apache服务器上已安装以下PHP依赖项
- libreoffice-headers
- uniconv
使用Composer(推荐)
Composer可以帮助管理PHP项目的依赖关系。更多信息请见:https://getcomposer.org.cn
将此包(buse974/dms
)添加到您的composer.json
文件中,或者直接在命令行运行以下命令
$ composer require buse974/dms
通过克隆项目
通过将其克隆到./vendor/
目录中安装[DMS]模块(https://github.com/buse974/Dms.git)。
安装后
此包遵循PSR-0自动加载标准。如果您使用composer安装,只需要求生成的自动加载器即可
require "<projectpath>/vendor/autoload.php";
安装daemon unoconv
以守护进程的方式执行脚本vendor/buse974/dms/bin/unoconv.sh
。
示例
vendor/buse974/dms/bin/unoconv.sh start
vendor/buse974/dms/bin/unoconv.sh stop
应用程序配置文件
在您的application.config.php
文件中启用它。
<?php return array( 'modules' => array( 'Dms', ), 'module_paths' => array( 'Dms' => __DIR__ . '/../vendor/buse974/dms', ), ), );
本地文件配置
将以下配置复制并粘贴到您的config/autoloader/local.php
文件中。您可以在<application_path>/vendor/buse974/dms/config/local.php.dist
中找到此配置。
'dms-conf' => array( /* * Allowed sizes - You can add as many as you need */ 'size_allowed' => array( array('width' => 300, 'height' => 200), array('width' => 300, 'height' => 300), array('width' => 150, 'height' => 100), array('width' => 80, 'height' => 80), array('width' => 300), ), /* * path where all the documents will be uploaded */ 'default_path' => 'upload/', /* * http adapter - You have to add your [http adapter](#HTTP-adapter) * in your config/autoloader/local.php or config/autoloader/global.php * If you already have a http adapter, please just specify its name */ 'adapter' => 'http-adapter', 'convert' => array( /* * path where you want to convert and stock the temporaries files * !! apache need all rights for writing and reading on this directory !! */ 'tmp' => '/tmp/', ), /* * the headers to add to your files - especially for cross-domain */ 'headers'=> array( 'Access-Control-Allow-Origin'=>'http://local.wow.in', 'Access-Control-Allow-Credentials'=>'true' ), ),
HTTP适配器(如果尚不存在)
'http-adapter' => array( 'adapter' => 'Zend\Http\Client\Adapter\Socket', 'maxredirects' => 5, 'timeout' => 10, 'sslverifypeer' => false, ),
使用
通过DMS服务
添加文档
$manager = $this->serviceManager->get('dms.service'); /* * exemple */ $image = file_get_contents(__DIR__ . '/../../_file/gnu.png'); /* * string - document's codings specified in `dma/coding/CodingInterface` */ $document['coding'] = 'base'; /* * mime-type */ $document['type'] = 'image/png'; /* * datas with specified encoding * if you choose url coding, you can add the picture url which will be uploaded and saved */ $document['data'] = base64_encode($image); /* * Return the document's token */ $token = $manager->add($document);
要访问此文件,请使用以下URL http://<dns>/data/<token> .
调整文档大小
按照上一个示例
/* * width x height in a string - Return a new token for the document resized */ $new_token = $manager->resize('80x80');
要访问此文件,请使用以下URL http://<dns>/data/<new_token> .
通过DMS管理器
添加和获取文档
$manager = $this->serviceManager->get('dms.manager'); /* * file exemple */ $image = file_get_contents(__DIR__ . '/../../_file/gnu.png'); $document = new Dms\Document\Document(); $document->setDatas($image); $document->setFormat('png'); $manager->loadDocument($document); $manager->setFormat('jpg'); $manager->setSize('80x80'); $manager->writeFile(); /* * Get the document */ $document = $manager->getDocument(); /* * Return the document's token */ $token = $document->getId();
通过URL访问
文档可以通过URL访问。
URL格式如下
http://mondomaine.com/<KEY>/<TOKEN>-<SIZE>[<NUM-PAGE>].<FORMAT>
如果文档不存在,则会自动转换和创建。
KEY可以是
data
size
description
format
encoding
###示例
基本文档
http://mondomaine.com/data/2b5c466bf06d665b479e85c48ec733d235d138
此URL显示标记为2b5c466bf06d665b479e85c48ec733d235d138的文档。
具有大小转换的文档
http://mondomaine.com/data/2b5c466bf06d665b479e85c48ec733d235d138-300x300
此URL显示标记为2b5c466bf06d665b479e85c48ec733d235d138的文档,并将其转换为300x300像素。
具有格式转换的文档
http://mondomaine.com/data/2b5c466bf06d665b479e85c48ec733d235d138.pdf
此URL显示标记为2b5c466bf06d665b479e85c48ec733d235d138的文档,并将其转换为pdf。