Search
 
SCRIPT & CODE EXAMPLE
 

PHP

spatie media library retrieve media from url

//To retrieve files you can use the getMedia-method:
$mediaItems = $yourModel->getMedia();
//The method returns a collection of Media-objects.


//You can retrieve the url and path to the file associated with the Media-object using getUrl, getTemporaryUrl (for S3 only) and getPath:
$publicUrl = $mediaItems[0]->getUrl();
$publicFullUrl = $mediaItems[0]->getFullUrl(); //url including domain
$fullPathOnDisk = $mediaItems[0]->getPath();
$temporaryS3Url = $mediaItems[0]->getTemporaryUrl(Carbon::now()->addMinutes(5));
Comment

PREVIOUS NEXT
Code Example
Php :: laravel blade @guest 
Php :: php load specific post id on language 
Php :: php pdo connection 
Php :: laravel get only relationship 
Php :: laravel get input from request 
Php :: 500 error php 
Php :: php goto 
Php :: bindings laravel 
Php :: required field in laravel admin 
Php :: vue mouseover 
Php :: access storage from the view laravel 6 
Php :: yii2 get action class in view 
Php :: php from 
Php :: php artisan cache 
Php :: prestashop get all products 
Php :: Laravel - create model, controller and migration in single artisan command 
Php :: php how to rename a file before saving it 
Php :: how to get value of textarea in php 
Php :: how to check exist in array in rule validation laravel 
Php :: PHP Deprecated: Function create_function() 
Php :: how to use dompdf in laravel 
Php :: remove decimal php 
Php :: php display errors 
Php :: How to insert time in table using CodeIgniter 
Php :: non negative integer validation laravel 
Php :: what sign is greater than or equal to php 
Php :: rename migration in laravel 
Php :: php print character x times 
Php :: woocommerce get post terms product 
Php :: date to string in php 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =