PHP code example of noerd / media

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

    

noerd / media example snippets


$url = app(\Noerd\Contracts\MediaResolverContract::class)->getImageUrl($mediaId);          // "web"
$url = app(\Noerd\Contracts\MediaResolverContract::class)->getImageUrl($mediaId, 'teaser');

// config/media.php
'variants' => [
    'web' => 1920,      // name => maximum width in pixels
    'teaser' => 640,
],
'variant_quality' => 82,
'variant_max_pixels' => 40_000_000,   // larger images are delivered as the original

app(\Noerd\Media\Services\AppFolderRegistry::class)
    ->register('accounting.receipt_import', 'ACCOUNTING', 'Receipt Import');
bash
php artisan noerd:install-media          # Install configs, navigation, storage disk and migrations
php artisan noerd:update-media           # Update the published YAML configuration files
php artisan media:regenerate-thumbnails  # Regenerate thumbnails for existing media
php artisan media:clear-variants         # Delete the cached image delivery variants
bash
composer update noerd/media
php artisan noerd:install-media