Home › Forums › ACF PRO › Create multiple images from one ACF upload › Reply To: Create multiple images from one ACF upload
If you do not want to use add_image_size() for all the image sizes you need then what you need to do is create an acf/save_post filter. In this filter you would use a combination of WP functions.
$imagedata = wp_get_attachment_metadata($attachment_id); to get all of the existing metadata
$resized = image_make_intermediate_size(get_attached_file($attachment_id), $width, $height, $crop); to have WP create the new image size
$imagedata['sizes'][$name] = $resized; to append your new size with your new name to the metadata
and then update the metadata
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!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.