Closed nvindice closed 2 years ago
The importer or any other class that is using the media controller should not need to know how to handle different files. Thus, adding similar code to scale() like in add() should do the job: https://github.com/aimeos/aimeos-core/blob/f3fa1ec4b293ef2052f07fcdb082f0b6d947366d/controller/common/src/Controller/Common/Media/Standard.php#L66-L68
When uploading a non-image media file via the admin interface, the media file gets a preview URL according to the mime type.
However, when importing products via CSV import, this does not work. The
process
function calls theupdate
function which creates previews via the Media contoller'sscale
function: https://github.com/aimeos/ai-controller-jobs/blob/77a6d3ebcc98f0dfbd1a9de2a42f5dbdfaec5bed/controller/common/src/Controller/Common/Product/Import/Csv/Processor/Media/Standard.php#L233-L235The
scale
function can only handle Images.Solution 1 (ugly): checking the media type in the Media here: https://github.com/aimeos/aimeos-core/blob/f3fa1ec4b293ef2052f07fcdb082f0b6d947366d/controller/common/src/Controller/Common/Media/Standard.php#L199-L201 ...and set the
$item
preview to a mime type thumbSolution 2: checking the media type in the CSV import processor (good) and either scale or add a mime type thumb - this would require to make this function
public
: https://github.com/aimeos/aimeos-core/blob/f3fa1ec4b293ef2052f07fcdb082f0b6d947366d/controller/common/src/Controller/Common/Media/Standard.php#L532What do you think?