Eiolon Posted December 13, 2007 Share Posted December 13, 2007 Let's say I want to have a maximum avatar dimensions of 100x100 pixels. That's easy to enforce by specifying the height and width in the image command. What would I need to do in order allow a 75x75 avatar be used by not be stretched to 100x100? Thanks! Currently, I am using: <img src="<?php echo $row_users['avatar'] ?>" height="100" width="100" /> Link to comment https://forums.phpfreaks.com/topic/81511-solved-restricting-avatar-size/ Share on other sites More sharing options...
papaface Posted December 13, 2007 Share Posted December 13, 2007 I would use http://uk3.php.net/manual/en/function.getimagesize.php to generate the height and width of the image on the fly. <?php list($width, $height, $type, $attr) = getimagesize($row_users['avatar']); echo '<img src="'.$row_users['avatar'] .'" height="'.$height.'" width="'.$width.'" />'; ?> Link to comment https://forums.phpfreaks.com/topic/81511-solved-restricting-avatar-size/#findComment-413808 Share on other sites More sharing options...
Eiolon Posted December 13, 2007 Author Share Posted December 13, 2007 Great, thanks! Link to comment https://forums.phpfreaks.com/topic/81511-solved-restricting-avatar-size/#findComment-413881 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.