username0136 this is not possible natively. You would have to use the REST API GET /api/users/<id> to get the new profile image URL.
To make it work without saving the custom filename on the external app, I see two solutions that could be implemented using the Flarum PHP extension API:
- Customize avatar file names to use username. Issue: if a user changes username, the script would also need to rename the files, something that's not needed with the default naming. Other issue: a cache busting query string should probably be added to Flarum if this is implemented so that the new image shows up immediately on the forum even with aggressive caching of assets
- Create a new Flarum REST API endpoint that takes a username and returns a redirect to the correct profile image. It could even provide a redirect to a default image for users who don't have an avatar
The second option is probably the easiest and most reliable solution to implement, at the cost of a bit of performance and some additional browser requests.
If this is only for a few users and you don't mind some manual work, you could rename their avatars to a memorable filename, change the filename in the Flarum database as well, and if the user ever changes avatar, rename the file again on disk and in the database to use the previous name.