I'm saving an Image when creating a post in my controller using the code below:
$post->addMedia($file)->withResponsiveImages()->toMediaCollection();
And displaying the responsive images in my blade file with:
{{ $post->getFirstMedia() }}
This works…
I am using Spatie MediaLibrary to upload documents into the database and right now I face an issue. Spatie uses public property $mediaComponentNames where I have to assign the media name. For example:
public $mediaComponentNames = ['myUpload'];
The…
Can I save image for 2 tables in db with same file request?
in controller
$combo = new Combo;
if ($request->hasFile('image') && $request->file('image')->isValid()) {
…
I have my existing $media instance and I would like to generate a thumbnail at $seconds.
I tried:
$media->manipulations = [
'thumb' => [
'height' => '250',
'extractVideoFrameAtSecond' => $seconds,
],
];
$media->save();
But get this…
I have a news aggregator site that grabs an image from a remote URL but the script is breaking with the following error when I try to crop the file after grabbing:
Expected the file at…
I have an array of file upload inputs, When I upload files in each and submit, the files get uploaded adequately, and in the media table, teach gets inserted with the correct file name, file path etc except the file_description field that saves same…
I added https://github.com/morawskim/faker-images to laravel 9 site and when I try get image from this lib
and to upload it with Medialibrary
$faker = \Faker\Factory::create();
$faker->addProvider(new…
Using Laravel Media Library, User 1 can send an image to User 2.
User 1's user ID is stored as a custom property in the media collection: 'from_user_id'
When retrieving user 2's images, how do I get the model for User 1 so that I can display their…
I'm trying to download all the uploads together under one user. If one user has uploaded under multiple collections, I want to download all uploads under all collections in one click as a zip file.
I tried without the collection name in getMedia…
I am trying to get media for certain modal as follows:
public function show(Gallery $gallery)
{
$images = $gallery->getMedia('default'); //returns images
// $images = $gallery->getMedia('default', ['name', 'original_url']);…
I have two input image in my form, and one registerMediaConversions :
public function registerMediaConversions(Media $media = null) : void
{
$this->addMediaConversion('big')
->performOnCollections('category-cover');
…
Problem is, that image files cannot be deleted via GUI, since the owner of the files is root (some images are created by a cronjob directly. There are also the conversions generated by medialibrary itself within a Laravel job.).
I did not find a way…
I am trying to get Spatie Media Library to work, but I have this error:
I really don't know where it comes from, any suggestions?
I'll leave a copy of the portion of the code where the error happens
Str.php
/**
* Replace the given value in the…
I am currently using the Spatie media library and I have created my own custom class as follows:
use Spatie\MediaLibrary\Models\Media as BaseMedia;
class TrybzMedia extends BaseMedia
{
protected $table = 'media';
protected $appends =…