This is not a question asking how to replace all the broken images with the default images. That question is answered here.
What I want to know is how to replace all the broken images with newly updated images. On my web chat application, users can update their profile pictures and the comments that are posted after the update will have the new pictures shown next to them. However, the new pictures won't be shown next to old comments that are posted before the update.
For example, when you change your profile picture on twitter, not only your profile picture will be updated, but also pictures beside your old tweets will be changed into the new pictures. This is what I want to do.
Does anyone know how to do that with node.js?
What @RajeshDan wrote is propably your best bet, use your
fs
module to update a user's image, while keeping both file-path and -name.If you have your profile-images in a folder
./public/images/profile/
you can update one with a form, that posts the image and the users unique ID (hopefully that's acutally unique).this also adds the image if there hasn't been one at that point