AdminLTE icon indicating copy to clipboard operation
AdminLTE copied to clipboard

Problem with displaying last Member box

Open kressly opened this issue 11 years ago • 11 comments

Hello I am displaying the Last member list with label but I am having a strange problem here. When it reaches 7 (i take the information from my database) some of the members go down 5

Please how to solve this ?


<li>





                    <!-- Container for the img -->
<div class='img-container'>
<?php

$chat_between_generer =  hash('sha512',"Chat Between $id_ojm_peoples AND $id_de_l_autre");

?>

<a  href="messages_lire.php?id_message=<?php echo $id_message; ?>&id_de_l_autre=<?php echo $id_de_l_autre; ?>&chat_between=<?php echo $chat_between_generer;  ?>" title="<?php echo $nom_prenom; ?>">
  <img src="<?php echo $url_avantar_profile; ?>" alt="<?php echo $nom_prenom; ?>" class="img-circle"  height="50"/>
  </a>
  <!-- The label -->
  <?php
  if($nombre_message_lu_id_de_lautre>0)
  {
    ?>
    <span class='label label-danger'><?php echo $nombre_message_lu_id_de_lautre; ?></span>
    <?php  
  }
  ?>



 <a class="users-list-name" href="messages_lire.php?id_message=<?php echo $id_message; ?>&id_de_l_autre=<?php echo $id_de_l_autre; ?>&chat_between=<?php echo $chat_between_generer;   ?>" title="<?php echo $nom_prenom; ?>">
 <?php echo $nom_prenom; ?>
 </a>

<span class="users-list-date"><?php echo time_ago($temps_envoye, $langue='en'); ?></span>

</div>

</li>


Is there something i am not doing right ?

kressly avatar Mar 11 '15 14:03 kressly

To debug it, you should inspect html output to see if it's right. From image i see only a strange effect with image: they aren't "square" in origin (eg. 128x128px) and you are using a fix height. From code, i see that your code is different from original

<li>
<img src="dist/img/user5-128x128.jpg" alt="User Image">
<a class="users-list-name" href="#">Sarah</a>
<span class="users-list-date">14 Jan</span>
</li>

because you added a div.img-container Now i haven't time to try, but hope that this can help you.

adaniello avatar Mar 11 '15 15:03 adaniello

Yes the images are rounded because i have added the class img-circle to it.

kressly avatar Mar 11 '15 18:03 kressly

I think the problem lies here (I'd have to see your css to be sure...):

The problem is, when you print the time_ago() it can either have 1 line or more lines of text, messing with the <li> total height.

You can give your <li>'s a fixed height and let them overflow down.

<li style="height: 100px"> (should prob. define this height on your css files) This should fix it, I guess.

andredp avatar Mar 11 '15 19:03 andredp

Both of @adaniello and @andredp are right. First, the images must have a square size (n by n). Second, the text returned by the function time_ago() must not be too long.

The quick and dirty fix

/* In your css add */
.users-list-date {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.users-list-avatar {
  max-width: 125px;
  max-height: 125px;
}

In your php file, chenge this line to remove the height="50" property and add class="users-list-avatar".

<img src="<?php echo $url_avantar_profile; ?>" alt="<?php echo $nom_prenom; ?>" class="img-circle users-list-avatar"/>

almasaeed2010 avatar Mar 11 '15 20:03 almasaeed2010

Just to give a complete answer. The proper fix would be to make sure that all uploaded images have the exact same size, which is easily accomplishable by using a crop image plugin like this one and force a constraint on the user.

almasaeed2010 avatar Mar 11 '15 20:03 almasaeed2010

@adaniello @andredp @almasaeed2010 Thanks to you all. However, When i remove the height and applied those fix it became worse. I reduce the text of my time_ago function, used a function to resize all my images to be displayed at 100 px maximum and then added the class by @almasaeed2010 and this is what i got 6

I also removed the circle and i got approximately the same result 7

However strangely doing all these and adding AGAIN the height 50 worked and i do not know why because it is supposed to work with the max-width and max-height. 8

Thanks to you all

@almasaeed2010 Thank you for the Image cropping script link

kressly avatar Mar 12 '15 12:03 kressly

Place a height property on the <li> tag then try again

almasaeed2010 avatar Mar 12 '15 13:03 almasaeed2010

@almasaeed2010 On which tag please ? The img ? That's what i did

kressly avatar Mar 12 '15 15:03 kressly

Sorry was supposed to be the <li>

almasaeed2010 avatar Mar 12 '15 15:03 almasaeed2010

Hi, is this fixed or you still need help?

lenamtl avatar Mar 12 '15 16:03 lenamtl

@almasaeed2010 I don't understand. You said i should place a height On <li> is it ? @lenamtl for now it seems to be working however i dont understand why unless i put height on the image it does not work with only css

kressly avatar Mar 12 '15 20:03 kressly