Reputation: 11
i have an image which width is 213 and height is 200 when i echo the image from my database and i resize it (echo "<img src='company/$present' width='70' height='68'/>";)
the image was not as clear as when it was 213 * 200. how can i make the image smooth like the original after i have resize it to 70 * 68 or rather when i increase above 213 * 200.
<?php
$query = "SELECT * FROM photo";
$result = mysql_query ($query) or die('query error');
$count = 0;
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){
$image = $line[picname];
echo "<img src='company/$image'/> ";
$count++;
}
?>
Upvotes: 1
Views: 2566
Reputation: 308206
Add the CSS tag img { -ms-interpolation-mode: bicubic; }
to choose smoother resizing in Internet Explorer 7. IE8 already uses this by default. I don't remember if it works in IE6.
Upvotes: 2
Reputation: 180024
how can i make the image smooth like the original after i have resize it to 70 * 68 or rather when i increase above 213 * 200.
Internet Explorer in particular seems to use a nasty algorithm for sizing images down. You'd be best off using a toolkit like ImageMagick or PHP's GD to size the image on the server-side.
Nothing's going to make upscaling look good.
Upvotes: 2
Reputation: 1562
The best way is to keep the images aspect ration, so basically if the image was 800 x 1200 , instead of resizing it to a certain pixel size do it by percent and make sure the width and height are being changed by the same percent.
Upvotes: 0
Reputation: 27561
As a general rule don't set both the width and the height explicitly for the image. It becomes very difficult to maintain the aspect ratio of the image that way.
Upvotes: 0