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