Home › Forums › ACF PRO › Save Post and populate field with image › Reply To: Save Post and populate field with image
Thanks for the post.
I would recommend you make use of the PHP function imagerotate() to rotate the image and then save back the rotated image as a new file.
The code would look like so:
//define image path $filename="image.jpg"; // Load the image $source = imagecreatefromjpeg($filename); // Rotate $rotate = imagerotate($source, $degrees, 0); //and save it on your server... file_put_contents("myNEWimage.jpg",$rotate);
For loading the newly created image, you can make use of the acf/load_field filter after storing the image object in a $variable.
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!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.