Support

Account

Home Forums ACF PRO Save Post and populate field with image Reply To: Save Post and populate field with image

  • 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.