I want to make user profile picture who only have account. But I dont know how to insert and display in the page that image form database, please support.

Assuming here that you already have raw binary data of the
image in the database, you also need to know the image type.

With these two pieces of information, you can write a
special HTML <img> tag that includes the image data
within the tag:

print '<img src="data:image/jpeg;base64,'.base64_encode($image['file_data']).'" alt="profile picture">';

Whether or not storing binary images in a database is a good practice is an entirely different debate altogether.

Regards, Shawn

You should be storing the image's filename in the database. So if you have a table users you could add a column profile_pic, for example. On your server have a directory storing the images (maybe public_html/images/profilepictures).

Then in your PHP code you can combine the directory with the filename to retrieve the image:

<?php 
define('PROFILE_PIC_DIR', '/images/profilepictures');

// query your DB for $user info
...

// Output image
?>
<img class="profile-picture" src="<?= PROFILE_PIC_DIR . $user['profile_pic']?>" alt="" />

To store image you can have a separate table in your Database.For eg:-
User[user_id,display_name,pic_id,email_id etc]
Profile_Pic[pic_id,file_type,file_location,file_name,file_size]

Now to insert file refer this or this.While inserting save corresponding data detail in database to map pic with user profile.

To display pic,EvolutionFallen has already provided solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.