PHP code example of fdevs / elfinder-php-connector
1. Go to this page and download the library: Download fdevs/elfinder-php-connector library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fdevs / elfinder-php-connector example snippets
FDevs\ElfinderPhpConnector\Connector;
use FDevs\ElfinderPhpConnector\Driver\LocalDriver;
$connector = new Connector();
//add local driver
$local = new LocalDriver();
$local->setDriverOptions(['path' => 'uploads', 'rootDir' => 'path/to/web/dir/']);
$local->setAdditionalImages([
'XL' => ['prefix' => 'XL', 'width' => 800, 'height' => 800],
'M' => ['prefix' => 'M', 'width' => 300, 'height' => 300]
]);
$connector->addDriver($local);
$src = $_SERVER["REQUEST_METHOD"] == 'POST' ? $_POST : $_GET;
$cmd = isset($src['cmd']) ? $src['cmd'] : '';
$response = $connector->run($cmd, $src);
echo json_encode($response);
use FDevs\ElfinderPhpConnector\Connector;
use FDevs\ElfinderPhpConnector\Driver\PhotatoesDriver;
use FDevs\Photatoes\Manager;
use FDevs\Photatoes\Adapter\YandexAdapter;
$connector = new Connector();
$manager = new Manager(new YandexAdapter('username'));
$photatoes = new PhotatoesDriver($manager);
$photatoes->setDriverOptions(['rootName' => 'yandex']);
$connector->addDriver($photatoes);
$src = $_SERVER["REQUEST_METHOD"] == 'POST' ? $_POST : $_GET;
$cmd = isset($src['cmd']) ? $src['cmd'] : '';
$response = $connector->run($cmd, $src);
echo json_encode($response);
namespace App\ElfinderPhpConnector\Driver;
use FDevs\ElfinderPhpConnector\Driver\DriverInterface;
class BestDriver implements DriverInterface
{
//...
}
$connector->addDriver(new BestDriver());