0

How to change an image

I have user profiles with avatars. I display image like this:

<img src="'images/<?=$default_image_data['image_name']?>" width=200 height=150>

What do I need? I want to choose new image from modal(?) list, update database and display new assigned image without page reload.

  1. Click buton "change image"
  2. Now I want to see modal with small thumbnails of images(like 150x100)
  3. I want to click on image to choose, next ajax-post to update row/assign new image to profile id
  4. on ajax success I want to display new image without page reload

Any ideas how to do it?

  • something like [this as shown here](https://stackoverflow.com/a/21322925) – Pirate Dec 07 '20 at 21:59
  • probably good solution for point 4. on ajax success: change image source, but how to code js for point 2 and 3? Any working examples? – shoopersine Dec 07 '20 at 22:06

0 Answers0