0
我想在上传过程中调整大小,而不是200x100。但是,我无法找到任何相关文件来进行此调整。调整上传的匹配图片的大小
经过一番搜索,我看到有多人告诉其他人看看connector.php。在这个文件中我需要传递的东西沿着这些路线如下:
$opts = array(
'bind' => array(
'upload resize' => array($this, 'myResize')
),
'roots' => array(
array(...)
)
);
/**
* Upload/resize callback catcher, resizes image to 320x240px/240x320px respectively, keeps ratio
*
* @param string $cmd command name
* @param array $result command result
* @param array $args command arguments from client
* @param object $elfinder elFinder instance
* @return true Forces elFinder to sync all events
* */
public function myResize($cmd, $result, $args, $elfinder) {
$files = $result['added'];
foreach ($files as $file) {
$arg = array(
'target' => $file['hash'],
'width' => 320,
'height' => 320,
'x' => 0,
'y' => 0,
'mode' => 'propresize',
'degree' => 0
);
$elfinder->exec('resize', $arg);
}
return true;
}
我的大问题是:
我在哪里可以把这个功能呢?我为Symfony2使用(FM)ElfinderBundle。
你不能把公共函数放在connector.php中,因为它会超出class – ymakux 2015-04-06 00:56:47