Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace old image #5

Closed
quaidesbalises opened this issue Sep 28, 2018 · 12 comments
Closed

Replace old image #5

quaidesbalises opened this issue Sep 28, 2018 · 12 comments
Labels
bug Something isn't working

Comments

@quaidesbalises
Copy link

Great package ! Curently if I upload an image for my client logo, it saves to S3 like a charm. But, if my client update his logo, it works but it doesn't delete the old one in the folder. Any improvements for this ?

@saqueib
Copy link
Member

saqueib commented Sep 28, 2018

Glad you liked it, please share config so I can try to reproduce it especially upload_disk & path and your model image field definition.

@quaidesbalises
Copy link
Author

quaidesbalises commented Sep 28, 2018

yes for sure :

config/imageup.php :

return [
    'upload_disk' => 's3',
    'upload_directory' => 'uploads',
    'auto_upload_images' => true,
    'auto_delete_images' => true,
    'resize_image_quality' => 80
];

app/Client.php :

protected static $imageFields = [
        'logo' => [
            'width' => 200,
            'height' => 100,
            'crop' => true,
            'path' => 'avatars'
        ]
    ];

ClientsController.php

public function update(Request $request)
    {
    	auth()->user()->update($request->all());
    }

@saqueib saqueib added the bug Something isn't working label Sep 29, 2018
saqueib added a commit that referenced this issue Sep 29, 2018
@saqueib saqueib closed this as completed Sep 29, 2018
@saqueib
Copy link
Member

saqueib commented Sep 29, 2018

run composer update, fix has been released as 1.0.1

@quaidesbalises
Copy link
Author

Hello,

Sorry but I always have the same problem with the same configuration. Any help about this ?

@saqueib
Copy link
Member

saqueib commented Oct 4, 2018

Are you still unable to delete old files on s3?

Please update the package, it should be version 1.0.2, delete composer.lock file and run composer update

@quaidesbalises
Copy link
Author

Yes, i upload the logo of my client in the logo field. That's work.
I update the logo, it works again but the old one is still on the s3 folder.
I'm on the last version of the package.

capture d ecran 2018-10-04 a 17 54 41

@saqueib
Copy link
Member

saqueib commented Oct 4, 2018

It could be due to IAM permission, make sure you have delete privilege on the bucket you are working with.

@quaidesbalises
Copy link
Author

capture d ecran 2018-10-04 a 18 02 19

This point is OK. I hope we could find a solution . :)

@saqueib
Copy link
Member

saqueib commented Oct 4, 2018

It's hard to debug since I am unable to reproduce it. If you can share your code on some repo then I can try to figure it out.

@saqueib
Copy link
Member

saqueib commented Oct 4, 2018

this is the image i uploaded https://acheter-un-appartement-neuf.s3.eu-west-1.amazonaws.com/avatars/4VYOiX5ow6XKRFtKfBX3MUCYMakjxXLvTJiFnk6c.jpeg

and now when I re-upload I am unable to access old image, which mean It was deleted.

@saqueib
Copy link
Member

saqueib commented Oct 4, 2018

Now new image is this
https://acheter-un-appartement-neuf.s3.eu-west-1.amazonaws.com/avatars/bdV4V6hyKDezgvIl7gg0cN3Zf6JQDtyF5jSy8ikU.jpeg

You cant access old one.

what version on laravel you are using, I am on 5.7

@quaidesbalises
Copy link
Author

quaidesbalises commented Oct 4, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant