Problem when showing image using S3 AWS



  • I am using S3 AWS to upload image in Asgard V2. The image is uploaded successfully to S3, but it seems wrong URL. I have checked the code in getUrl function Modules\Media\ValueObjects\MediaPath.php. It is now return Storage::url($this->path). I replaced it by return (new BaseUrlResolver())->resolve($this->path) (it was in Asgard 1) and it works.

    I also tried to change 'default' => 'local' to 'default' => 's3' in config/filesystems.php but it throws the error.

    So how can I show right S3 image url without changing the code in MediaPath.php, please help me.


  • admin

    Hello,

    Indeed since v2 it uses laravel's built-in way to handle the URL resolution vs what I did manually before.

    It shouldn't cause issues on your end though as laravel does basically the same thing I did before.
    Make sure that you're on the latest version of Asgard, the method should look like this: https://github.com/AsgardCms/Platform/blob/2.0/Modules/Media/ValueObjects/MediaPath.php#L28-L30

    I've used this with my S3 bucket and I didn't come across issues.



  • Oh It seems I am not using the latest version. I downloaded 2 weeks ago. I update the latest code and it works. Thanks so much.


  • admin

    Awesome :)


Log in to reply
 

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.