drewneon
Delete avatar image file from local storage
Thanks a lot! I've tried Method 1, the avatar file was successfully deleted when I clicked the "x" button and then the Update button. However, when I tried to set a new avatar, it threw the following error when hitting the Update button.
League\Flysystem\Filesystem::delete(): Argument #1 ($location) must be of type string, null given, called in /var/www/filament/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 513
This error points to the line within the isDirty
condition.11 replies
Delete avatar image file from local storage
Thanks again! From the steps to enable user avatars I learned from the web page mentioned previously, I don't see where the url of the old avatar is stored, i.e. the new avatar url is stored and replaces the old one in the db immediately after hitting the Update button, including avatar deletion. If removing the avatar image file from disk is not doable simutanesouly, the only way I could think of is comparing all the avatar files with all the user's avatar urls in the db and deleting unmatched ones then, which is quite resource comsuming, especially when there are thousands of avatar image files as the web site grows.
11 replies