PHP code example of moderntribe / tribe-storage

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

    

moderntribe / tribe-storage example snippets


function tribe_isSSL(): bool {
	return ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] !== 'off' );
}

$host = $_SERVER['HTTP_HOST'] ?? 'localhost';

define( 'WP_CONTENT_URL', ( tribe_isSSL() ? 'https' : 'http' ) . '://' . $host . '/wp-content' );

// Account name as you created it in the Azure dashboard.
define( 'MICROSOFT_AZURE_ACCOUNT_NAME', 'account' );

// Account secret key to authenticate.
define( 'MICROSOFT_AZURE_ACCOUNT_KEY', 'key' );

// The container name.
define( 'MICROSOFT_AZURE_CONTAINER', 'my_container' );

// The custom adapter namespaced path to the adapter.
define( 'TRIBE_STORAGE_ADAPTER', 'Tribe\Storage\Adapters\Azure_Adapter' );

// The URL/CNAME to use for the adapter.
define( 'TRIBE_STORAGE_URL', 'https://example.com/wp-content/uploads/' . MICROSOFT_AZURE_CONTAINER );

// For GD
define( 'TRIBE_STORAGE_IMAGE_EDITOR', 'gd' );

// For Imagick
define( 'TRIBE_STORAGE_IMAGE_EDITOR', 'imagick' );

// Store transients in the object cache instead of the database.
add_filter( 'tribe/storage/config/cache/force_db', '__return_false' );