PHP code example of finnwiel / shazzoo-media

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

    

finnwiel / shazzoo-media example snippets


public function panel(Panel $panel): Panel
{
    return $panel
        ->viteTheme('resources/css/filament/admin/theme.css')
        ->plugins([
                \Awcodes\Curator\CuratorPlugin::make()
                    ->label('Media')
                    ->registerNavigation(true)
                    ->showBadge(true)
            ])
}

ShazzooMediaPicker::make('featured_image_id')
                    ->conversions(['thumbnail'])
                    ->fileType(), // 'image', 'icon', 'document'

use FinnWiel\ShazzooMedia\Traits\HandlesConversions;

class CreatePost extends CreateRecord
{
    use HandlesConversions;

    protected static string $resource = PostResource::class;
}

'conversions' => [
    'profile' => ['width' => 80, 'height' => 80],
    'thumbnail' => ['width' => 200, 'height' => 200],
    'medium' => ['width' => 400, 'height' => 400],
    'large' => ['width' => 600, 'height' => 600],
],

'conversions' => [
    'profile' => ['width' => 80, 'height' => 80, 'fit' => 'crop'],
    'thumbnail' => ['width' => 200, 'height' => 200],
    'medium' => ['width' => 400, 'height' => 400],
    'large' => ['width' => 600, 'height' => 600],
    'small' => ['width' => 100, 'height' => 100],
],

$image->thumbnail_url  // returns URL for the 'thumbnail' conversion
$image->web_url        // returns URL for the 'web' conversion

// In your Post.php model
use FinnWiel\ShazzooMedia\Models\ShazzooMedia;

public function featuredImage()
{
    return $this->belongsTo(ShazzooMedia::class, 'media_id');
}

// In your Product.php model
use FinnWiel\ShazzooMedia\Models\ShazzooMedia;

public function gallery()
{
    return $this->hasMany(ShazzooMedia::class, 'product_id');
}

php artisan vendor:publish --tag=shazzoo-media-policy
bash
php artisan shazzoo_media:install
css
@source '../../../../vendor/awcodes/filament-curator/resources/views/**/*.blade.php';
@source '../../../../vendor/finnwiel/shazzoo-media/resources/views/**/*.blade.php';
bash
php artisan vendor:publish --tag=shazzoo_media-config
bash
php artisan vendor:publish --tag=shazzoo-media-model