You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm importing a load of files from a legacy system (Which isn't using Laravel or Media Library), and they are being inserted into the Laravel project's media DB table, in the correct formatting for this library.
However, the generated_conversions column is always an empty object.
I have ran the media-library:regenerate command, which correctly goes through and generates the conversions for me.
However, some files already have the conversions created, so I don't want to regenerate them (It's slow and more resource heavy). So I run it with --only-missing:
media-library:regenerate --only-missing
This correctly does not regenerate the images , that already exist. The problem is that the generated_conversions column is not updated either.
What I need to do, is to run through and generate all of the missing conversions, but also to update the generated_conversions column if the conversion isn't missing in the file system, but is missing from the DB entry.
Looking at the code, I can't see an easy way to do this, and it looks like I might have to loop through all the data myself, check if the file exists, and then run the Media model's markAsConversionGenerated() method:
But I think this might no really be faster than just regenerating the images, as I'd have to do it as a separate run, after running the media-library:regenerate command.
Does anyone know of a possible better way of doing this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm importing a load of files from a legacy system (Which isn't using Laravel or Media Library), and they are being inserted into the Laravel project's
media
DB table, in the correct formatting for this library.However, the
generated_conversions
column is always an empty object.I have ran the
media-library:regenerate
command, which correctly goes through and generates the conversions for me.However, some files already have the conversions created, so I don't want to regenerate them (It's slow and more resource heavy). So I run it with
--only-missing
:This correctly does not regenerate the images , that already exist. The problem is that the
generated_conversions
column is not updated either.What I need to do, is to run through and generate all of the missing conversions, but also to update the
generated_conversions
column if the conversion isn't missing in the file system, but is missing from the DB entry.Looking at the code, I can't see an easy way to do this, and it looks like I might have to loop through all the data myself, check if the file exists, and then run the
Media
model'smarkAsConversionGenerated()
method:laravel-medialibrary/src/MediaCollections/Models/Media.php
Lines 208 to 219 in 5d4930d
But I think this might no really be faster than just regenerating the images, as I'd have to do it as a separate run, after running the
media-library:regenerate
command.Does anyone know of a possible better way of doing this?
Beta Was this translation helpful? Give feedback.
All reactions