1、根目录加入路由
位置在:
\lib\private\route\router.php的145行,
例如:
先在上面文件的145行加入一行:
//测试 require_once 'test/routes.php';
然后加入一个test的根目录,然后再在根目录下加入路由文件routes.php,内容如下:
<?php /** * Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ namespace OC\Test; $this->create('test_test', 'test/test') ->actionInclude('test/test.php');
最后再加入到test文件夹中一个test.php的文件,内容如下:
<?php /** * Created by PhpStorm. * User: sunny * Date: 2015/9/18 * Time: 16:18 */ echo "哈哈哈哈";那么便可以通过地址:http://sunny.ownclouddemo.com/index.php/test/test访问到这个test.php文件,显示如下:
至此就完成了根目录下加入文件夹并能访问的情况。
待继续。。。
2、缩略图不生成大于200宽度的图片
第一、修改\lib\private\preview.php 文件 从第529行开始修改成以下代码:
$maxX_thumbnail=\OC::$server->getSystemConfig()->getValue('maxX_thumbnail'); if($maxX<$maxX_thumbnail) { //根据传值切图 $this->resizeAndCrop(); //获取图片所在路径 $previewPath = $this->getPreviewPath($fileId); //建立本地缩略图目录 $cachePath = $this->buildCachePath($fileId); if ($this->userView->is_dir($this->getThumbnailsFolder() . '/') === false) { $this->userView->mkdir($this->getThumbnailsFolder() . '/'); } if ($this->userView->is_dir($previewPath) === false) { $this->userView->mkdir($previewPath); } //将图片存储到本地 $this->userView->file_put_contents($cachePath, $preview->data()); }
第二、在\config\config.php中加入,配置:
//缩略图可存储本地的大小限制配置
'maxX_thumbnail'=>200,
以上,完成修改。