How scaling 100% a image in a fixed area in bootstrap/ anything else?

I do something -

$count = $result->rowCount();
while($count>0)
{
    echo '<div class="container">';
    $i=0;
    while($i<3)
    {
      $row = $result->fetch(PDO::FETCH_ASSOC);
      echo '<div class="row">';
        echo '<div class="col-sm-4">';
        echo '<div class="panel panel-primary">';
        echo '<div class="panel-body"<a href="sample.php?id="';
        echo $row['imageurl'];
        echo '"><img src="../';
        echo $row['imageurl'];
        echo '"class="img-responsive" style="width:250px;height:250px" alt="Image" id="';
        echo $row['imageurl'];
        echo '" onclick="getImageId(this.id);"></div>';
        echo '<div class="panel-footer">';
        echo $row['name'];
        echo '</div></div></div>';
        $i++;
        $count--;
    }
}

I fixed the width and height so that each image take same area. But, for this the shape of image is damaged as different image have different width:height ratio.