ACF Image field type, return array, use specific image size in Cornerstone

In a Cornerstone Single Layout I am using an ACF image type field as the source for an image element, like this:
{{dc:acf:post_field field="project_description_ft_image"}}

This works, but it returns the full size image. I need to be able use a specific size. I tried using the developer tools and adding this to the image_src:
{{dc:acf:post_field field="project_description_ft_image" key="sizes.tablet-squared"}}

But that did not work. Is there a way to use a specific size of image in Cornerstone? I know I can do this when looping over a gallery field. But not on a single image? Am I missing something?

I remember a while back someone mentioning that there was a way to use the dev console in Cornerstone to specify the image size of a featured image, but I can’t remember the method. Looking in the dev console now, I’m not sure which field I would edit or how.

Thanks for your help.

Hello @adaptifyDesigns,

Thanks for writing in!

Setting your Gallery field return format to “Image Array”, this will allow you to retrieve all the attachment meta data WordPress makes available on the image. To retrieve it, you can do this:

  • Add a Dynamic Content Looper provider set to {{dc:acf:post_field field="project_description_ft_image"}}
  • Use {{dc:looper:field key="alt"}} to access alt text
  • Use {{dc:looper:field key="sizes.medium"}} to get the medium thumbnail
  • Inside your consumer, add a text element with this content: {{dc:looper:debug_consumer}} . This will let you see all the data you have available. Then the corresponding key can be used with the syntax above (alt text, thumbnail, etc.) to get other bits of information.

Hope this makes sense.

1 Like

Thanks for the tip Rue, the debug_consumer looks very useful. But that’s not what I was asking about in my support request. I’m looking for a way to select specific image size for just a normal ACF Image field, not a Gallery looper. Does that make sense. It’s a post field, not a looper field. Like this:
{{dc:acf:post_field field="project_description_ft_image"}}

Is there a way to choose which image size is output in that case?

Additionally, is there a way to choose the image size output for a post featured image?

Thanks.

Hello @adaptifyDesigns,

Since your ACF field is returning an Array, you should be running a loop first before you can get the image sizes. By the way, there is already a feature request that you can access the image size by using something like this: {{dc:acf:post_field field="project_description_ft_image" size="medium"}}

Our development team will take this into account in the future.

Thanks for understanding

Ok, thanks. And what about the post featured image? Is there a way to get a specific size?

Hello @adaptifyDesigns,

For the featured image dynamic content, you can use this:

{{dc:post:featured_image_id size="small"}}

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.