Custom file path in products

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!
milos_shomsy
Posts: 7
Joined: 03 Aug 2020, 13:30

Custom file path in products

Post by milos_shomsy » 03 Aug 2020, 13:51

Hello,

I am using Ameous package in Laravel 6.x version.
I would like to ask how can I change the upload path of product images?

So far I found I can change upload folders in shop.php config file like this:

Code: Select all

'fs' => [
            'adapter' => 'Standard',
            'basedir' => storage_path('app/public'),
            'tempdir' => storage_path('tmp'),
        ],
Now, I would like to have same ulr media paths in view since they are not shown in admin panel:

https://www.dropbox.com/s/2mf5wtveou5e5 ... 2.png?dl=0

How can I do this, please?

Thanks in advance,
Milos

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

Re: Custom file path in products

Post by aimeos » 04 Aug 2020, 05:56

You have to adapt the baseurl for the "fs" configuration in that case:
https://github.com/aimeos/aimeos-larave ... lt.php#L47
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

milos_shomsy
Posts: 7
Joined: 03 Aug 2020, 13:30

Re: Custom file path in products

Post by milos_shomsy » 04 Aug 2020, 10:53

Hello again,

First, thanks for the fast reply. :)
Now I would like to know one more thing about this topic.

So, I updated shop.php like you said:

Code: Select all

'fs' => [
            'adapter' => 'Standard',
            'basedir' => storage_path('app/public'),
            'tempdir' => storage_path('tmp'),
            'baseurl' => config('app.url') . '/storage/',
        ],
Now I need those paths to be saved in media table. I miss that "/storage/" in link and preview fields.
https://www.dropbox.com/s/174z22cxggwb3 ... 8.png?dl=0

Do I need to extend some class to get this? And if I do what would be the way to to that?

Thanks in advance,
Milos

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

Re: Custom file path in products

Post by aimeos » 04 Aug 2020, 11:23

The file paths in the database are relative to your "basedir" directory and that's OK:

Code: Select all

'basedir' => storage_path('app/public')
The "baseurl" path will be prepended to your paths in the database to get the real URL.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply