New added product preview image (in 720) is not shown in product details page.

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!
User avatar
aimeos
Administrator
Posts: 8004
Joined: 01 Jan 1970, 00:00

Re: New added product preview image (in 720) is not shown in product details page.

Post by aimeos » 14 May 2024, 07:37

Did you enable/change the ASSET_URL in your .env file?
https://github.com/aimeos/aimeos/blob/m ... example#L7

If yes, try to remove that setting as it's only useful for remote cloud storages
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Sabir_Ali
Posts: 29
Joined: 12 Feb 2024, 06:43

Re: New added product preview image (in 720) is not shown in product details page.

Post by Sabir_Ali » 14 May 2024, 08:22

Did you enable/change the ASSET_URL in your .env file?
https://github.com/aimeos/aimeos/blob/m ... example#L7
No. I did not edit it. Today I was trying to use it but I get only loosing all styles and media on the site.

Is there any file system configuration (I mean config/filesystem.php or somewhere else) to redirect storing media files on adding new products?

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

Re: New added product preview image (in 720) is not shown in product details page.

Post by aimeos » 14 May 2024, 08:58

The base URL for images is defined here:
https://github.com/aimeos/aimeos/blob/m ... p.php#L137

In the templates, the real URLs are created by calling the "$this->content()" view helper, e.g.:

Code: Select all

<img src="<?= $enc->attr( $this->content( $mediaItem->getPreview(), $mediaItem->getFileSystem() ) ) ?>">
See: https://github.com/aimeos/ai-client-htm ... hp#L51-L54

The filesystem column in the mshop_media table must contain "fs-media" for images.

For responsive images with srcset, the "$this->image()" view helper takes care about creating the real URLs:
- https://github.com/aimeos/ai-client-htm ... ge.php#L27
- https://github.com/aimeos/ai-client-htm ... rd.php#L55
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Sabir_Ali
Posts: 29
Joined: 12 Feb 2024, 06:43

Re: New added product preview image (in 720) is not shown in product details page.

Post by Sabir_Ali » 15 May 2024, 06:57

Yes. The solution accepted by us is changing default directory for media files in config/shop.php in 'fs-media'.
Thanks a lot!

Sabir_Ali
Posts: 29
Joined: 12 Feb 2024, 06:43

Re: New added product preview image (in 720) is not shown in product details page.

Post by Sabir_Ali » 15 May 2024, 13:43

But I forgot one thing. How to add the following configuration as external

Code: Select all

'common' => [
        'media' => [
            'product' => [
                'previews' => [
                    [
                        'maxwidth' => 720,
                        'maxheight' => 960,
                        'force-size' => 1,
                    ],
                ],
            ]
        ],
    ],
to avoid edit configuration in the aimeos-core/config/controller.php?

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

Re: New added product preview image (in 720) is not shown in product details page.

Post by aimeos » 16 May 2024, 06:20

Add that configuration to your ./config/shop.php
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Sabir_Ali
Posts: 29
Joined: 12 Feb 2024, 06:43

Re: New added product preview image (in 720) is not shown in product details page.

Post by Sabir_Ali » 17 May 2024, 08:48

I asked this question about configuration because I was trying to use this approach before, and had no result. I know, that this is normal practice to use config/shop.php file to add our own configurations. But it doesn't work for me. I spent almost two days in searching a way to merge this configuration.

So, I tried many ways, like using merging in shop.php, app.php, Service Provider, Extension Service Provider. And now I'm trying Decorator but still in process.

It looks like configuration aimeos-core/config/controller.php loads after all cached configurations at runtime. The key method that need this config is createPreviews() in src/Controller/Common/Media/Standard.php (of 2023.10-th version). And I need to make this method to use modified configuration externally.
What I'm doing wrong?

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

Re: New added product preview image (in 720) is not shown in product details page.

Post by aimeos » 17 May 2024, 08:50

Please show your merged ./config/shop.php (without the credentials).
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Sabir_Ali
Posts: 29
Joined: 12 Feb 2024, 06:43

Re: New added product preview image (in 720) is not shown in product details page.

Post by Sabir_Ali » 17 May 2024, 09:01

Sure. Here is in the attachments.
Attachments
config.shop.tar.gz
(2.46 KiB) Downloaded 59 times

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

Re: New added product preview image (in 720) is not shown in product details page.

Post by aimeos » 17 May 2024, 09:06

You've missed the 'controller' key where it must be merged below and guess this won't work too:

Code: Select all

'previews' => array_merge(config('controller.common.media.product.previews', []), [
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply