Jump to content

[SOLVED] Restricting avatar size


Eiolon

Recommended Posts

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

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.'" />';
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.