vendredi 27 juillet 2018

laravel-medialibrary: Add image dimensions to custom properties on each upload

Is there a way to add image dimensions on each media upload of laravel-medialibrary?

Im am thinking about something like this:

public function registerMediaCollections() {
    $this->addMediaCollection('main')
        ->singleFile()
        ->withCustomProperties([
            "width" => 600,
            "height" => 400
        ]);
}

Just to make it more clear - I don't want to manipulate the image itself, I just want to store image width and height in the database, to have the possiblity to query for it. Something like SELECT * FROMmediaWHERE JSON_EXTRACT(custom_properties, "$.width") > 600)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire