如何调整从sql查询显示的图像?

I am in testing phase of a new project ,just learning my self how to work with php , so i know pdo is better and will learn it soon

Now to the question

I wrote a registration page which includes profile picture and i am saving it in the fb fine , but i am having issue with retrieving it and resizing it

This is the code requesting the image

<?php
include("dbconfig.php");
// Create connection
$conn=mysql_connect($db_host,$username,$password) or die('Error1');;

mysql_select_db("motorklq_glmindb",$conn) or die('Error2');


$result = mysql_query("SELECT fname,lname,profilepic FROM gtable");

echo "<table><tr><th>Firstname</th><th>Lastname</th><th>Image</th></tr>";

while($row = mysql_fetch_array($result)){
    print "<tr><td>".$row['fname']."</td><td>".$row['lname']."</td><td>".'<img src="data:image/jpeg;base64,' . base64_encode( $row['profilepic'] ) . '" />'."</td></tr>";
}
print "</table>";
mysql_close($conn);
?>

now the image displayed is full size , how can i make it 20*20 resize without any change in aspect ratio ?

add profilepic in select query and change query

SELECT fname,lname,profilepic FROM gtable

and

base64_encode( $row['image'] )

to

base64_encode( $row['profilepic'] ) 

in your table image storing in profilepic field

EDIT

image size

<img src="data:image/jpeg;base64,' . base64_encode( $row['profilepic'] ) . '"  width="42" height="42">

check this link for more http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_img_height

image field missing in your query

$result = mysql_query("SELECT fname,lname,profilepic FROM gtable");