Implement screen to show saved images if present and register if not input type = file

Asked 2 years ago, Updated 2 years ago, 42 views

When creating a member information management screen,

If you haven't registered your profile picture, look like above

If you have registered your profile picture, I want you to show it like this.

The image storage logic is

After uploading, when you press the Save button, the image file is saved to the web server directory and the path is saved to db.

The above css used jasny bootstrap.

I'm developing the file for the first time, but there are a lot of things to pay attention to and it's hard ㅠ<

image file bootstrap

2022-09-21 18:31

1 Answers

I don't know which template engine you use, but logic is simple.

When importing a photo path from DB, you can upload it if it is empty, and if so, you can lead it to change and delete it

if image // has an image
    <img src="{{image}}"> // Process image display from template
    <input type="file"> // change and delete markup
else // or
    <img src="nothing.png"> // White Photo 
    <input type="file"> //upload
endif

You can handle it like this.


2022-09-21 18:31

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.