Skip Navigation

[Resolved] Types field image is stretched and grainy

This thread is resolved. Here is a description of the problem and solution.

Problem: I'm trying to display a Types custom field image at 50px x 50px using the Types field shortcode, but it is displayed much larger and stretched out.

Solution: In this case the theme or other plugins are adding CSS that stretch out images here to fill the available space. You would have to apply overriding CSS to fix that stretch.

This support ticket is created 6 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 5 replies, has 2 voices.

Last updated by saint 6 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#1180281

I'm encountering another image situation with Types, where I'm trying to constrain and return an image with a small size (e.g. 50px by 50px), but rather it returns a large, grainy image.

hidden link

Is there a way to display the small version of that image? Thank you for your help.

#1180297
Screen Shot 2019-01-08 at 3.55.09 PM.png

Hi, I would have to see this in a browser to be sure what's going on. What I can see in your video is these two images are shown on the screen much larger than 50px square. They're more like 180px square, and this video is scaled down if I'm not mistaken. So that leads me to believe there is some CSS or JavaScript in place that stretches these images out to fill space or as a responsive design feature, bypassing the sizes generated by the Types field shortcode. Otherwise, the image dimensions on my screen would be smaller - more like 50px square in this image. You may have to add some CSS overrides to modify this image size.

#1180312

Hi Christian,

Sure no worries - please see below for test URL.

hidden link

Is there also a place where I can input private credentials in case to poke around?

Best,

#1180376

Sure, I will activate private reply fields here.

#1180922

Okay as I suspected there is some CSS applied by the bb plugin or one of the addons. I'm attaching a screenshot here showing the browser inspector. This is where you can look at all the CSS styles applied to an element. You'll see the red rectangle around a style that sets the width of these images to be 100%. This means that even though Toolset generates an image at 50x50, it gets stretched out to fill the space in its parent container. To fix this, you would have to either modify the styles generated for this UABB post grid, or add your own styles to override them. Modification of these styles is not something I can help with, you would need to contact the BB or UABB support team.

If you want to override these styles, you can wrap your image shortcode in another div. Add a specific class name to that div, like this:

<div class="my-smaller-pic">
[types field='headshot' title='%%TITLE%%' alt='%%ALT%%' align='center' size='custom' width='100' height='100' resize='crop'][/types]
</div>

Then in Appearance > Additional CSS, you can add override styles like this:

.my-smaller-pic > img {
  width: auto;
}

If you need more information about CSS overrides with specificity, look here: https://www.smashingmagazine.com/2007/07/css-specificity-things-you-should-know/

#1183377

Thanks, Christian. Appreciate the support. I've gone ahead and used Microthemer to bring the padding back down from 100% to 25% on each, and it seems to be resolved for now.