Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. make project thumbs have a fixed height / while filling it in with the correct aspect ratio

make project thumbs have a fixed height / while filling it in with the correct aspect ratio

Scheduled Pinned Locked Moved General Discussion
9 Posts 4 Posters 813 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • leoooL Offline
    leoooL Offline
    leooo
    wrote on last edited by
    #1

    Hi all,
    I will just rewrite my question cause my old post was not really clear:
    is it possible to give the thumb container a specific height (px or %) and then let the project thumbnail be filled in with the object-fit: cover CSS command?

    So to say I would want to have the possibility in the thumbnail grid to change to height of the thumbnails, without interfering with the actual aspect ratio of the image. Also if that means cropping.

    Im not sure if that is a feature request or something i could solve with adding CSS to the thumb class.

    thanks a lot in advance

    Leo

    1 Reply Last reply
    0
    • mariusjopenM Offline
      mariusjopenM Offline
      mariusjopen
      Global Moderator
      wrote on last edited by
      #2

      Dear @leooo
      this is the only way I can think of:

      .ph {
          padding-bottom: 50% !important;
      }
      
      .ph img {
          object-fit: cover;
      }
      

      Hope that helps!

      Best!

      Marius

      www.mariusjopen.world

      leoooL 1 Reply Last reply
      0
      • mariusjopenM mariusjopen

        Dear @leooo
        this is the only way I can think of:

        .ph {
            padding-bottom: 50% !important;
        }
        
        .ph img {
            object-fit: cover;
        }
        

        Hope that helps!

        Best!

        Marius

        leoooL Offline
        leoooL Offline
        leooo
        wrote on last edited by leooo
        #3

        @mariusjopen said in make project thumbs have a fixed height / while filling it in with the correct aspect ratio:

        Dear @leooo
        this is the only way I can think of:

        .ph {
            padding-bottom: 50% !important;
        }
        
        .ph img {
            object-fit: cover;
        }
        

        Hope that helps!

        Best!

        Marius

        @mariusjopen
        Wow you saved my day! that is exactly the thing i was looking for! Now i dont need to make square thumbnails for everything and I like that I can play around with the % for the height!
        Seriously I would have never gotten to that solution with my basic css skills. I didnt even find the .ph class in the inspector ^^
        So useful especially for mobile! Thanks a lot!
        http://editedit.dreamhosters.com/category/test/

        leoooL 1 Reply Last reply
        0
        • leoooL leooo

          @mariusjopen said in make project thumbs have a fixed height / while filling it in with the correct aspect ratio:

          Dear @leooo
          this is the only way I can think of:

          .ph {
              padding-bottom: 50% !important;
          }
          
          .ph img {
              object-fit: cover;
          }
          

          Hope that helps!

          Best!

          Marius

          @mariusjopen
          Wow you saved my day! that is exactly the thing i was looking for! Now i dont need to make square thumbnails for everything and I like that I can play around with the % for the height!
          Seriously I would have never gotten to that solution with my basic css skills. I didnt even find the .ph class in the inspector ^^
          So useful especially for mobile! Thanks a lot!
          http://editedit.dreamhosters.com/category/test/

          leoooL Offline
          leoooL Offline
          leooo
          wrote on last edited by
          #4

          @mariusjopen sorry I know this is not a CSS workshop: but Im too curious to know how the logic behind the lines is.
          the padding bottom command is referring to which elements in the layout?

          1 Reply Last reply
          0
          • mariusjopenM Offline
            mariusjopenM Offline
            mariusjopen
            Global Moderator
            wrote on last edited by
            #5

            Dear @leooo
            the padding is used to set the height of the images.
            This is kind of a trick and is not very commonly used. But in the Gridder it is very useful.

            You can change the padding to change the height of the images.

            Hope that helps :-)

            Best!

            Marius

            www.mariusjopen.world

            1 Reply Last reply
            0
            • leoooL Offline
              leoooL Offline
              leooo
              wrote on last edited by
              #6

              @mariusjopen yes very much. i was playin around with that already very useful. But I realized its better to disable this in the specific project view, cause it messes around with cover feature and generally images in the first row of the gridder. but still so very useful! thanks a lot!

              1 Reply Last reply
              0
              • mariusjopenM Offline
                mariusjopenM Offline
                mariusjopen
                Global Moderator
                wrote on last edited by
                #7

                Dear @leooo
                you could make it only for for a specific Thumbnail Grid when you give it an idea.

                Best!

                Marius

                www.mariusjopen.world

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  felix_rabe
                  wrote on last edited by
                  #8

                  @mariusjopen is it possible to use this method with an element grid in stead of a thumbnail grid?

                  In the element-grid, the ph container seems to be empty.

                  1 Reply Last reply
                  0
                  • RichardR Offline
                    RichardR Offline
                    Richard
                    Global Moderator
                    wrote on last edited by
                    #9

                    Dear @fr

                    With Project Thumbnails within the Element Grid this is possible - With standard images not.
                    The image dimensions are set normally and not with this 'PH' padding.

                    So Image <img> being 100% width and its parent container controlling its dimensions:

                    E.g

                    .parent-container{
                    width:48%;
                    }
                    
                    img{
                    
                    width:100%;
                    height:auto;
                    
                    }
                    

                    Hope this answers your question :)

                    Best wishes
                    Richard

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    I also code custom websites or custom Lay features.
                    šŸ’æ Email me here: šŸ’æ
                    info@laytheme.com

                    Before you post:
                    1. When using a WordPress Cache plugin, disable it or clear your cache.
                    2. Update Lay Theme and all Lay Theme Addons
                    3. Disable all Plugins
                    4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

                    This often solves issues you might run into

                    When you post:
                    1. Post a link to where the problem is
                    2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                    3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                    Online Users
                    Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                    laytheme.com
                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Search