This is not an issue.
But I am not knowing how to develop my idea with ACF.
I know that I have to use acf_save and wp_image_editor to achieve this though.
wp_image_editor is documented and so of course by WP.
I got two fields for image-object, with the names of:
‘img-standing’
‘img-horizontal’
I want only for the user logged in to upload a standing wine-bottle into the ‘img-standing’. And the horizontal image should be done automatically through the wp-image-editor and then set to the ACF-field ‘img-horizontal’.
I could also use CSS to make rotation, but I dont want to go that way as it is for now in this application. I rather rely on the images being accessible as files.
Thanks for any input.
Hi @hejamartin,
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.