I want to display images in my search page as a part of echoed content as a result of search query. These images have different resolutions and what's also very important for the next part they are not squarish. For displaying these photos I've initially used something like this:
if ($queryResult > 0){
while ($row = mysqli_fetch_assoc($result)){
echo '<img src="data:image/jpeg;base64,'.base64_encode($row['photo']).'" ">';
echo "<a href='account.php?username=".$row['username']."&id=".$row['id']."' style='text-decoration:none; color:rgb(0,0,0)'>
<div class='article-box'>
<h3>".$row['username']."</h3>
</div>
</a>";
}
}
But sadly the photos displayed were very big so the result wasn't satisfying me. That's why later I set image displaying part like this:
echo '<img src="data:image/jpeg;base64,'.base64_encode($row['photo']).'" width="150" height="150">';
Again it didn't give me good results. Although the images were then finally small, the non-squarish images were turned into squares what caused them to be deformed. How to display images nicely, I mean to keep them small or of exact size but not to deform them.