Home › Forums › Front-end Issues › Image field not outputting srcset attribute with image ID › Reply To: Image field not outputting srcset attribute with image ID
Don’t know if this helps, but generally when I’m planning images sizes none of the ones I create have heights and these are generally based on device screen resolutions, for example
add_image_size('size-1', 1280, 0, false); add_image_size('size-2', 1024, 0, false); add_image_size('size-3', 640, 0, false);
But then this means that you can’t constrain the height of the image and some could be taller than others unless you add specific sizes to min and max so that users can only upload images that will fit exactly, for example setting the min/max sizes for the image field to that same values 1280×400 would mean that the user can only upload this exact size image.
You can do the same thing with the min/max settings on cropped images, for example if you have a place where you always want to use a 4:3 ratio image, just set the min/max acf settings to the largest size 4:3 ratio you want to use.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.