PHP code example of x000000 / storage-manager

1. Go to this page and download the library: Download x000000/storage-manager 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/ */

    

x000000 / storage-manager example snippets




$baseDir = '/path/to/the/storage/directory';
$baseUrl = '/static';
$storage = new \x000000\StorageManager\Storage(
    // this is a full path to the directory where files will be stored in
    $basedir,
    // this is a url to the directory above (how directory will be available by HTTP)
    $baseUrl
);



$image = $storage->processFile('/full/path/to/image.png');



$image = $storage->processUploadedFile($_FILES['your_file_key']);
html
<img src="<?= $storage->getSource($image);