PHP code example of drewroberts / media
1. Go to this page and download the library: Download drewroberts/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/ */
drewroberts / media example snippets
return [
...
'disks' => [
...
'cloudinary' => [
'driver' => 'cloudinary',
'key' => env('CLOUDINARY_KEY'),
'secret' => env('CLOUDINARY_SECRET'),
'cloud' => env('CLOUDINARY_CLOUD_NAME'),
'url' => env('CLOUDINARY_URL'),
'secure' => (bool) env('CLOUDINARY_SECURE', true),
'prefix' => env('CLOUDINARY_PREFIX'),
]
]
];
return [
'transforms' => [
'cover' => 't_cover',
'cover_placeholder' => 't_coverplaceholder',
],
// Relative path; wrapped with url() in code when no image exists
'fallback_image' => 'img/ogimage.jpg',
// YouTube Data API V3 integration (Non-OAuth)
'youtube' => [
// Set in your application's .env
'api_key' => env('YOUTUBE_API_KEY'),
// HTTP request options
'timeout' => 8.0, // seconds
'base_url' => 'https://www.googleapis.com/youtube/v3',
// Preferred order for selecting thumbnails
'thumbnail_preference' => [
'maxres', 'standard', 'high', 'medium', 'default',
],
],
];
php artisan vendor:publish --tag=media-config