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 を使用しています。