Support » Fixing WordPress » Galleries with thumbnail img width=”1″ height=”1″ Problem

  • christinapitt76

    (@christinapitt76)


    I want my thumbnails all roughly the same size but not forced so that they look warped or cropped and my images have unpredictable dimensions. I changed Media Settings Image Sizes to Thumbnail Size Width = 200 Height = 0 and unchecked “Crop thumb…” I also set Width and Height for Medium Size and Large Size to zero and removed add image size code from my theme. And … it worked perfectly!!! Thumbs are proportionally correct with various heights but all have width = 200. My uploads folder has only the original image and one thumbnail created, so not tons of sizes of each image that I will never use. Search results and category lists (from menu items) also work perfectly, grabbing the thumbnail and lining them up perfectly so I have multiple columns all 200 pixels wide and rows look great all the thumbnails are aligned along the top edge and extend down different lengths according to their proportion height.
    The problem starts when I create wordpress galleries. I use the native wordpress gallery option inside each post, not a separate gallery plugin. Gallery settings are link to Media File, Columns 2 and Size Thumbnail. When I am editing the post the images show full size, which is weird, but at least they show. I save or update the post and I still see the images in the edit window, but I when I view it on the website no images, just dots like you would see in an ordered list. Source for the live post includes

    <div id='gallery-1' class='gallery galleryid-26707 gallery-columns-2 gallery-size-thumbnail'><figure class='gallery-item'>
    			<div class='gallery-icon '>
    				<a data-attachment-id="11284" href='http://localhost/wp-content/uploads/image-1.jpg'><img width="1" height="1" src="http://localhost/wp-content/uploads/image-1.jpg" class="attachment-thumbnail size-thumbnail" alt="" /></a>
    			</div></figure><figure class='gallery-item'>
    			<div class='gallery-icon '>
    				<a data-attachment-id="11285" href='http://localhost/wp-content/uploads/image-2.jpg'><img width="1" height="1" src="http://localhost/wp-content/uploads/image-2.jpg" class="attachment-thumbnail size-thumbnail" alt="" /></a>
    			</div></figure><figure class='gallery-item'>
    			<div class='gallery-icon '>
    				<a data-attachment-id="11282" href='http://localhost/wp-content/uploads/image-3.jpg'><img width="1" height="1" src="http://localhost/wp-content/uploads/image-3.jpg" class="attachment-thumbnail size-thumbnail" alt="" /></a>
    			</div></figure> 
    		</div>
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Yeah, apparently the gallery does not account for zero values well in image size settings. I don’t think zero values were ever intended to be valid. I suggest you set the dimensions to square aspect. As long as the image size is not set to be cropped the original aspect will be maintained. Depending on the image orientation, you may not get the size you want, but that can be managed with the “wp_constrain_dimensions” filter where you can alter the resize parameters depending on the orientation.

Viewing 1 replies (of 1 total)
  • The topic ‘Galleries with thumbnail img width=”1″ height=”1″ Problem’ is closed to new replies.