csv import: no media generation; srcset=""

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
columbo
Advanced
Posts: 157
Joined: 09 Oct 2019, 09:42

csv import: no media generation; srcset=""

Post by columbo » 07 Jul 2025, 19:22

Hi,

for some reason, no preview images are generated druing/after a csv import. (Aimeos 2024.10)
But with a manual upload via the Aimeos admin backend they are.

4 medias in different sizes should be generated; so my shop.php

Code: Select all

'mshop/media/manager/previews/product' => 
[
	['maxwidth' => 200, 'maxheight' => 200, 'force-size' => 0],
	['maxwidth' => 320, 'maxheight' => 320, 'force-size' => 0],
	['maxwidth' => 545, 'maxheight' => 545, 'force-size' => 0],
	['maxwidth' => 1050, 'maxheight' => 1050, 'force-size' => 0],
],

After manually uploading product images in the Aimeos backend, all product images are generated and displayed correctly in the shop on the category and detail pages:

Code: Select all

<img loading="lazy" itemprop="image" 
src="/aimeos/1.d/product/5/9/5973ad9f_a283c692_565006-my-product-abc.webp?v=20250707205419" 
srcset="/aimeos/1.d/product/5/9/5973ad9f_a283c692_565006-my-product-abc.webp?v=20250707205419 200w, 
/aimeos/1.d/product/c/2/c24603f2_a283c692_565006-my-product-abc.webp?v=20250707205419 320w, 
/aimeos/1.d/product/e/2/e28f89f6_a283c692_565006-my-product-abc.webp?v=20250707205419 545w, 
/aimeos/1.d/product/a/d/addfa35a_a283c692_565006-my-product-abc.webp?v=20250707205419 1050w" 
sizes="(max-width:200px) 200px, (max-width:320px) 320px, (max-width:545px) 545px, 1050px" 
alt="My Product ABC">

But after csv import (file including 'media.url', 'media.type' and 'media.label')
No medias are generated; only the original image provided by the csv import is displayed.

on catalog page:

Code: Select all

<img loading="lazy" itemprop="image" 
src="/aimeos/prodimg/my-product-abc.jpeg" 
srcset="" 
sizes="(max-width:200px) 200px, (max-width:320px) 320px, (max-width:545px) 545px, 1050px" 
alt="My Product ABC">

also executed

Code: Select all

php artisan aimeos:jobs "product/import/csv"
but no effect

What is missing, why are the medias are not generated by csv import?

Thank you!

User avatar
aimeos
Administrator
Posts: 8636
Joined: 01 Jan 1970, 00:00

Re: csv import: no media generation; srcset=""

Post by aimeos » 10 Jul 2025, 07:32

Can you check what happens here in your case, please?
https://github.com/aimeos/ai-controller ... #L218-L226
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

columbo
Advanced
Posts: 157
Joined: 09 Oct 2019, 09:42

Re: csv import: no media generation; srcset=""

Post by columbo » 13 Jul 2025, 13:36

when updating an image (new image url in csv)
https://github.com/aimeos/ai-controller ... d.php#L223
executed

$refItem

Code: Select all

(
    [available:protected] => 1
    [modified:protected] => 1
    [bprefix:protected] => media.
    [type:protected] => 
    [bdata:protected] => Array
        (
            [.languageid] => 
            [media.siteid] => 1.
            [media.type] => prodimage
            [media.domain] => product
        )
    [langid:Aimeos\MShop\Media\Item\Standard:private] => 
    [listItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [listRmItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [listMap:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [listMax:Aimeos\MShop\Media\Item\Standard:private] => 0
    [propItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (       )
    [propRmItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [propMax:Aimeos\MShop\Media\Item\Standard:private] => 0
)
$list:

Code: Select all

(
    [media.type] => prodimage
    [media.label] => My Product ABC
)
url:

Code: Select all

prodimg/my-product-abc.jpeg  
$refItem after execution of:
$refItem = \Aimeos\MShop::create( $this->context(), 'media' )->scale( $refItem->setUrl( $url ), true );

Code: Select all

(
    [available:protected] => 1
    [modified:protected] => 1
    [bprefix:protected] => media.
    [type:protected] => 
    [bdata:protected] => Array
        (
            [.languageid] => 
            [media.siteid] => 1.
            [media.type] => prodimage
            [media.domain] => product
            [media.url] => prodimg/my-product-abc.jpeg
        )
    [langid:Aimeos\MShop\Media\Item\Standard:private] => 
    [listItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [listRmItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [listMap:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [listMax:Aimeos\MShop\Media\Item\Standard:private] => 0
    [propItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [propRmItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [propMax:Aimeos\MShop\Media\Item\Standard:private] => 0
)


when importing csv with same image url as before (image url remains unchanged)
https://github.com/aimeos/ai-controller ... d.php#L225

Code: Select all

(
    [available:protected] => 1
    [modified:protected] => 
    [bprefix:protected] => media.
    [type:protected] => 
    [bdata:protected] => Array
        (
            [media.id] => 557643
            [media.siteid] => 1.
            [media.ctime] => 2025-07-13 13:58:51
            [media.mtime] => 2025-07-13 13:58:51
            [media.editor] => aimeos:jobs
            [media.type] => prodimage
            [media.label] => My Product ABC
            [media.domain] => product
            [media.languageid] => 
            [media.mimetype] => 
            [media.url] => prodimg/my-product-abc.jpeg
            [media.previews] => Array
                (
                )
            [media.filesystem] => fs-media
            [media.status] => 1
            [cgroups] => 0
            [media.preview] => Array
                (
                )
            [.languageid] => 
        )
    [langid:Aimeos\MShop\Media\Item\Standard:private] => 
    [listItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [listRmItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [listMap:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [listMax:Aimeos\MShop\Media\Item\Standard:private] => 0
    [propItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [propRmItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [propMax:Aimeos\MShop\Media\Item\Standard:private] => 0
)

Code: Select all

(
    [media.type] => prodimage
    [media.label] => My Product ABC
)

Code: Select all

url: prodimg/my-product-abc.jpeg
$refItem after execution of:
$refItem = \Aimeos\MShop::create( $this->context(), 'media' )->scale( $refItem->setUrl( $url ) );

Code: Select all

(
    [available:protected] => 1
    [modified:protected] => 
    [bprefix:protected] => media.
    [type:protected] => 
    [bdata:protected] => Array
        (
            [media.id] => 557643
            [media.siteid] => 1.
            [media.ctime] => 2025-07-13 13:58:51
            [media.mtime] => 2025-07-13 13:58:51
            [media.editor] => aimeos:jobs
            [media.type] => prodimage
            [media.label] => My Product ABC
            [media.domain] => product
            [media.languageid] => 
            [media.mimetype] => 
            [media.url] => prodimg/565006 Frischk. Rollino bunter Pfeffer2.jpeg
            [media.previews] => Array
                (
                )
            [media.filesystem] => fs-media
            [media.status] => 1
            [cgroups] => 0
            [media.preview] => Array
                (
                )
            [.languageid] => 
        )
    [langid:Aimeos\MShop\Media\Item\Standard:private] => 
    [listItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [listRmItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [listMap:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [listMax:Aimeos\MShop\Media\Item\Standard:private] => 0
    [propItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [propRmItems:Aimeos\MShop\Media\Item\Standard:private] => Array
        (        )
    [propMax:Aimeos\MShop\Media\Item\Standard:private] => 0
)
= = =

in both cases (new url and unchanged url) no medias are generated

User avatar
aimeos
Administrator
Posts: 8636
Joined: 01 Jan 1970, 00:00

Re: csv import: no media generation; srcset=""

Post by aimeos » 14 Jul 2025, 06:58

In case of unchanged URLs, no preview images should be generated so that's the intended behavior.
For new URLs, there should be preview images afterwards. Are there any errors in the logs? If not, can you please check in the media managerr what happens in that case?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

columbo
Advanced
Posts: 157
Joined: 09 Oct 2019, 09:42

Re: csv import: no media generation; srcset=""

Post by columbo » 14 Jul 2025, 19:18

thank you for your hin - found!
The reason is that the product images are in .jpeg format (and not in .jpg). Mimetype is not set for .jpeg

Is there an option to add .jpeg as supported filetype?

User avatar
aimeos
Administrator
Posts: 8636
Joined: 01 Jan 1970, 00:00

Re: csv import: no media generation; srcset=""

Post by aimeos » 16 Jul 2025, 08:13

You can change this entry for the file extension -> mime type relationship:
https://github.com/aimeos/aimeos-core/b ... ia.php#L53

Using this configuration:
https://aimeos.org/docs/2024.x/config/m ... extensions
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply