I am using these two packages:
"maatwebsite/excel": "^3.1",
"spatie/laravel-medialibrary": "^10.0.0",
I'm importing an Excel sheet with queuing and when a cell contains URL-s, then I am using medialibrary's addMediaFromUrl() like this:
$media = $product
->addMediaFromUrl($string)
->preservingOriginal()
->toMediaCollection(Product::MEDIA_COLLECTION);
$media->save();
The importer file is prepared to work in queues:
class ADOBProductsImport implements ToModel, WithValidation, WithHeadingRow, WithChunkReading, WithEvents, ShouldQueue
{
/**
* @see https://docs.laravel-excel.com/3.1/imports/chunk-reading.html
*
*/
public function chunkSize(): int
{
return 10;
}
...
}
Model looks like this:
public function registerMediaConversions(Media $media = null): void
{
$this->addMediaConversion('thumb')
->setManipulations(['h' => 100, 'fm' => 'png', 'fit' => 'max'])
->performOnCollections(self::MEDIA_COLLECTION)
->queued();
$this->addMediaConversion('medium')
->setManipulations(['h' => 600, 'fit' => 'max'])
->performOnCollections(self::MEDIA_COLLECTION)
->queued();
$this->addMediaConversion('thumb')
->setManipulations(['h' => 100, 'fm' => 'png', 'fit' => 'max'])
->performOnCollections(self::MEDIA_MAIN)
->queued();
$this->addMediaConversion('medium')
->setManipulations(['h' => 600, 'fit' => 'max'])
->performOnCollections(self::MEDIA_MAIN)
->queued();
}
...when I'm importing the Excel sheet, I receive this message I mentioned in the subject. Any idea?
I tried to not use queue, but then even if I have no errors not saving the images though...