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 wp_update_attachment_metadata($attachment_id, $imagedata);
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.