Skip Navigation

[Resolved] How do I make images retain their original aspect ratio?

This support ticket is created 6 years, 7 months 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 6 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#668625
Screen Shot 2018-04-15 at 3.15.01 PM.png

I have created a custom image field for a custom post type, how do I make the images retain their original aspect ratio?

In the image field in the custom post type, images are being force to fit the image sizes set in Settings > Media. (390x600 for medium images).

Example here:
hidden link

#671530

Hello,

I assume we are talking about the custom image field "Case Study Featured Image", you are using Types shortcode to display the custom image field, please try to add resize='crop' in the Types shortcode and test again, for example:

[types field='case-study-featured-image' alt='%%ALT%%' title='%%TITLE%%' size='medium' align='none' resize='crop'][/types]

More help:
https://toolset.com/documentation/customizing-sites-using-php/functions/#image
resize:
'crop' | 'proportional' | 'stretch' | 'pad'

#674808

Hi,

Yes, I can see where the shortcode needs to be modified, but I need to have it set it to the correct default in the custom image field.

I have to turn this site over to the client and can't ask her to edit a shortcode each time, the image has to be displayed correctly by default.

I remember there being a choice for how to display the image when I created the custom image field, but can't locate where to modify this now.

Since there's a setting for this somewhere, would rather not add PHP, just want to change the setting, but need help to find it.

Hope you can help.

#677028
image-field.JPG

Please elaborate the question with more details:
I remember there being a choice for how to display the image when I created the custom image field, but can't locate where to modify this now.
What kind of choice do you need when you create the custom image field?
You can specific the displaying settings when you insert the Types image shortcode, option "Pre-defined sizes" choose "Custom size..." , then you will be able to specific image displaying settings, see screenshot image-field.JPG