Refine the logic for loading thumbnails
It is necessary to return the logic when importing data from the XML feed, at the time of loading the image to our bucket (object storage), generate thumbnails of the image using the laravel medialibrary library, saving them in the media table.
The code in which you can see how it was done earlier (the history of commits): https://gitlab.com/kluchpro.tech/api/-/blob/64bb1541ce8c74f9fbdeac369fc972a57f2bce35/app/Models/Offer.php
If possible, reuse previously written code.
At this point, were using the data acquisition logic (API) in the API repository and to store the data in the ERP repository.
The Offer model to which we upload the images is in both repositories
Connect the laravel medialibrary libraryCreate migrations that would add the columns necessary for the operation of this logic to the existing media tableAd the necessary configuration in the model (describe conversions)Add in the logic of importing data from the XML feed, the code that would generate additional images of different sizes (see below) and save information about them in the database.Add the output of links to these images in the API resource based on the stored information in the database https://gitlab.com/kluchpro.tech/api/-/blob/master/app/Http/Resources/MediaResource.php
The expected result, each image in addition to the link to the original scale in the API response appeared additional links with different scales (thumbnails)
Thumbnail scales
small width 350medium width 750large 1920
23.12.2022 19:17