• Hello WP users
    I’m trying to set up a Gallery Block page. I have two questions, please.
    (1) I want nice square images. But when I choose the thumbnail option, the images are fuzzy. When I choose Full Size, they are clear but oblong. How can i get clear square images. Has anyone got a piece of code for making the Full Size images square.
    (2) I’d like the images to grey out a bit on mouseover. Anyone got a bit of code for that?
    THanks

    • This topic was modified 2 years, 6 months ago by mnatseah624.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thumbnail would already be the right choice for the image format. There, 150×150 pixels is normally set – fits your requirement. If this does not apply to you, then your theme may have set its own values for this. You should be able to adjust these in the theme.

    To influence the images when the mouse is touched, you could store the following in Customizer > Additional CSS:

    a:hover > img {
      opacity: 0.8;
    }

    This will make them slightly transparent. Or you can use this to create a light grey veil over the image:

    .wp-block-image a:hover:before {
      content: "";
      display: block;
      position: absolute;
      right: 0;
      left: 0;
      bottom: 0;
      top: 0;
      z-index: 1;
      background-color: rgba(0,0,0.2);
    }
    Thread Starter mnatseah624

    (@mnatseah624)

    Thanks @threadi Really good of you to reply.
    Your first code works great to brighten the link pics.
    The second code works, but it makes the whole pic black, including the text. I was wanting something to darken the pic a little so that the text would be better seen. Do you have a revised version of this code?

    As for the square pics, yes, I understand that 150×150 thumbnails are the right size. But for some reason they are all blurred. Any idea why this might be?

    There is a spelling mistake in the second code. Wrong is:

    background-color: rgba(0,0,0.2);

    Correct is:

    background-color: rgba(0,0,0,0.2);

    Then it is not completely black. I find it striking that it only works with the one picture. The others have no links around them. Is that intentional? Otherwise you could also use the following:

    .wp-block-image:hover:before {
      content: "";
      display: block;
      position: absolute;
      right: 0;
      left: 0;
      bottom: 0;
      top: 0;
      z-index: 1;
      background-color: rgba(0,0,0.2);
    }

    In your case, the images are currently output as original and reduced by CSS. If you would change this to thumbnail (and thus 150x150px), one could see what you mean in this respect.

    Thread Starter mnatseah624

    (@mnatseah624)

    Hello @threadi
    Many thanks for your help last week. I wanted to complete that Gallery Page before I got back to you. It’s now here.
    https://brightmorningstar.org/mysteries/
    What you suggested is working now. But while it greys the img a bit, it also greys the text. My ideal would be a bit more like this page: https://zeihan.com/know-your-world/
    Of course, it doesn’t have to be exactly the same.
    But I’d like a piece of code that…
    (1) Darkens the lower fifth or quarter of the img
    (2) Makes the text stand out brightly on the darkened background.
    (3) Makes a one or two px blue or purple frame round the pic on hover.
    (4) Best of all, if the text could appear only on hover, and disappear after.
    Any pointers would be much appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Gallery Blocks’ is closed to new replies.