Gang Rape Galore Story Contest | Entries
Voting has begun! Time left: Timer Loading

Fix for squished avatar images

There is something you'd like to ask, suggest or tell us about? Then this is the right place to let us know.
User avatar
chloevee
Pillar of the Community
Sophomore
Posts: 39
Joined: Wed Apr 16, 2025 7:40 pm

Fix for squished avatar images

Post by chloevee »

I haven't tested in browsers other than Chrome, but on the View Profile page I noticed that avatar images are often squished. (Or is it just me?) I wrote some CSS that fixes it.

(If admins are interested and don't know how to add custom CSS I can bundle it into a phpBB style that can be more easily installed.)

No hard feelings if this is not wanted or not a priority. Feel free to disregard.

Before:
Image

After:
Image

CSS:

Code: Select all

/*
 * Modificatons to phpBB purplexion theme.
 * https://www.phpbb.com/customise/db/style/purplexion/
 *
 */
body.section-memberlist {

  /*
   * View Profile page
   *
   * - Don't squish avatar image.
   * - Improve the layout of avatar image (left) and details (right).
   * - Improve the layout of details (Username, Groups, etc) on narrower
   *   screens.
   */
  form#viewprofile {
    .panel.bg1:first-child .inner {
      display: flex;
      flex-wrap: wrap;
      gap: 1em;

      .left-box {
        float: unset;

        &.avatar-rank-container {
          max-width: unset;

          .profile-avatar img {
            max-width: unset;
          }
        }


        &.profile-details {
          flex-grow: 1;

          display: grid;
          grid-template-columns: repeat(2, max-content);
          align-content: start;
          max-width: fit-content;

          dt {
            text-align: right;
          }

          &, dt {
            float: unset;
            clear: unset;
            width: unset;
          }

          dd {
            width: max-content;
            white-space: nowrap;
          }
        }
      }
    }
  }
}

User avatar
Claire
Admin
Research Assistant
Posts: 758
Joined: Mon Feb 24, 2025 7:21 am

Re: Fix for squished avatar images

Post by Claire »

I hadn't noticed that before, thanks for letting us know. And even more so for providing us a fix for the issue, it's much appreciated.

I hadn't encountered the issue before, but when I open a profile on my PC and adjust the size of the browser window it adjusts the size of the avatar dynamically to make it fit better, I suppose. Maybe you encounter that resizing of avatars more often in mobile view.

I'll talk about this with @Vela Nanashi and test your fix on my test forum to see whether it causes any issues. Thanks for the help!
My stories: Claire's Cesspool of Sin. I'm always happy to receive a comment on my stories, even more so on an older one!
User avatar
Vela Nanashi
Admin
Graduate
Posts: 352
Joined: Mon Feb 24, 2025 8:28 am

Re: Fix for squished avatar images

Post by Vela Nanashi »

Should I believe be able to simply add a single global css rule to all images:

img { object-fit: contain; }

Yep tested that on w3schools try it https://www.w3schools.com/css/css3_object-fit.asp that will make the image fit inside the intended containers without stretching it will just touch the inner edges, like it should.

You can paste this code into their try it editor and experiment with width and height on the image itself, to see it obeying that. It is the only object-fit I personally want us to use, it can also cut the sticking out bits off, and that is not what I want at all, as it hides part of the image.

Code: Select all

<!DOCTYPE html>
<html>
<head>
<style>
img {
  object-fit: contain;
}
</style>
</head>
<body style='background: black; color: white;'>

<h2>Image</h2>
<img src="paris.jpg" alt="Paris" width="200" height="300">

</body>
</html>
User avatar
Vela Nanashi
Admin
Graduate
Posts: 352
Joined: Mon Feb 24, 2025 8:28 am

Re: Fix for squished avatar images

Post by Vela Nanashi »

Also thanks for pointing this out to us and providing a fix. My fix is different, I did not like that the image pushed the other elements out of the way, it is fine if we make a new style/theme that does that, I am not sure if all images would push the same amount.

However we can maybe work on editing the theme/style later to make it waste less space for things that are not the main content :)
User avatar
chloevee
Pillar of the Community
Sophomore
Posts: 39
Joined: Wed Apr 16, 2025 7:40 pm

Re: Fix for squished avatar images

Post by chloevee »

Vela Nanashi wrote: Fri Apr 18, 2025 6:04 am Should I believe be able to simply add a single global css rule to all images:

img { object-fit: contain; }
That's a much more simple solution!

I tested it locally and it does indeed fix the problem on the profile page. Thanks for taking the time to address this!
User avatar
Vela Nanashi
Admin
Graduate
Posts: 352
Joined: Mon Feb 24, 2025 8:28 am

Re: Fix for squished avatar images

Post by Vela Nanashi »

It may take a bit to show up on forum proper, but it was very good that you spotted the issue. I am happy to have observant and competent folks reporting what they see and even finding solutions. So thank you for that :)
User avatar
Claire
Admin
Research Assistant
Posts: 758
Joined: Mon Feb 24, 2025 7:21 am

Re: Fix for squished avatar images

Post by Claire »

@chloevee It took a moment but the issue should be fixed now. Thank you so much again for making us aware of this. I'll give you some rep for this! And thx @Vela Nanashi for helping me implement the solution.
My stories: Claire's Cesspool of Sin. I'm always happy to receive a comment on my stories, even more so on an older one!
User avatar
Vela Nanashi
Admin
Graduate
Posts: 352
Joined: Mon Feb 24, 2025 8:28 am

Re: Fix for squished avatar images

Post by Vela Nanashi »

Can get a bit hectic sometimes to get to things, but it should be there now :) also thanks again for reporting the issue, and coming up with a solution, please do so in the future too :) at least reporting bit, you don't have to come up with solution though, but I loved that you did :)
User avatar
chloevee
Pillar of the Community
Sophomore
Posts: 39
Joined: Wed Apr 16, 2025 7:40 pm

Re: Fix for squished avatar images

Post by chloevee »

You guys rock!