Hi,
I’m using the front end acf_form to upload posts.
It’s working fine if i don’t select a image.
But if i want to upload a image to be the featured image i get the following error:
Warning: filesize()
Warning: getimagesize()
Warning: Cannot modify header information
If i use the option in the array ‘uploader’ => ‘basic’ is get this error.
When user ‘uploader’ => ‘wp’ its working fine
In my functions.php u use this function to set the featured image:
add_action( ‘acf/save_post’, ‘tsm_save_image_field_to_featured_image’, 10 );
function tsm_save_image_field_to_featured_image( $post_id ) {
// Bail if not logged in or not able to post
if ( ! ( is_user_logged_in() || current_user_can(‘publish_posts’) ) ) {
return;
}
// Bail early if no ACF data
if( empty($_POST[‘acf’]) ) {
return;
}
// ACF image field key
$image = $_POST[‘acf’][‘field_575ec9736147a’];
// Bail if image field is empty
if ( empty($image) ) {
return;
}
// Add the value which is the image ID to the _thumbnail_id meta data for the current post
add_post_meta( $post_id, ‘_thumbnail_id’, $image );
}
Does anybody know what is going wrong?
Cheers in advance