I am trying to display an image from a custom image field I've created with Types.
This issue can be seen in the screenshot below. I expected to see an image cropped to 1080x675. Instead, I got a 1512x2016 image scaled down to fit the column width.
The content template uses Divi Builder with the following as a shortcode:
{!{types field='mission-trip-quick-facts-image' size='et-pb-post-main-image-fullwidth' url='true' resize='crop'}!}{!{/types}!}
et-pb-post-main-image-fullwidth is an image size defined as 1080x675.
Does the image size exist?
I mean, when you upload the images, the thumbnails are added in that dimension?
This will only work if you registered that dimension in your theme.
When I do that, it works fine with the ShortCode, without the Builder and with the Builder of DIVI.
So, even if the sizes are visible in the GUI, first, the images need to be uploaded with that size (this happens automatically during the upload process if the sizes are registered correctly).
I tested this with DIVI and Views/Types locally.
I created an image field, then uploaded an Image field to that Field in a post, and styled that post with a Content Template that holds this ShortCode:
{!{types field='image' alt='%%ALT%%' title='%%TITLE%%' size='et-pb-post-main-image-fullwidth' align='none' resize='crop'}!}{!{/types}!}
It outputs this HTML:
<img width="1080" height="675" src="<em><u>hidden link</u></em>" class="attachment-et-pb-post-main-image-fullwidth" alt="" style="" title="Bildschirmfoto 2018-02-22 um 09.36.52" srcset="<em><u>hidden link</u></em> 3360w, <em><u>hidden link</u></em> 300w, <em><u>hidden link</u></em> 768w, <em><u>hidden link</u></em> 1024w, <em><u>hidden link</u></em> 220w" sizes="(max-width: 1080px) 100vw, 1080px">
This is pretty much correct, I think.
If your results are different I suggest running a thumbnail regenerator or similar to ensure the images exist on the site in this dimensions.
The site has a few image-related plugins. I wonder if perhaps some of them are interfering:
* Regenerate Thumbnails
* WP Offload S3 by Delicious Brains
* WP Smush Pro by WPMUDEV
I am not aware of clashes with any of those unless the WP Offload S3 Plugin which is incompatible since almost 2 years now:
The problem is that the size attribute isn't affecting the image being displayed.
Thread:
https://toolset.com/forums/topic/problem-of-toolset-types-image-filed-and-wp-offload-s3/
This could be what you experience here.
Can you confirm that it is solved if you do not use this Plugin?
I am not sure how you disable it, I suppose, there is more to it than just click disable.
I am not even sure if you can afford to disable it, as far I know this plugin interacts with CDN services?
Please let me know if you can confirm this.
We have plans to fix this in Types 2.4 (after the Many to Many Releases), but this not an ETA.
I cannot grant that it will be in 2.4 just yet.
I will definitely upvote the BUG report if you can confirm that we run into the same here, as until now, we have one example of usage only, related to this Plugin.