Support

Account

Forum Replies Created

  • Thanks again John,

    This works great for me:

    add_action('acf/save_post', 'convert_to_base64');
    function convert_to_base64( $post_id ) {
    
    	// Get newly saved values.
    	$values = get_fields( $post_id );
    
    	// Check the new value of a specific field.
    	$icon_set = get_field('icon', $post_id);
    	$icon_output = get_field('icon_base64', $post_id);
    	$icon_default = 'No icon';
    	
    	if( $icon_set ) {
    		$image = $icon_set;
    		$finfo = new finfo(FILEINFO_MIME_TYPE);
    		$type  = $finfo->buffer($image);
    		$base64 = "data:".$type.";charset=utf-8;base64,".base64_encode(file_get_contents($image));
    		update_field('icon_base64', $base64, $post_id);
    	} else {
    		update_field('icon_base64', $icon_default, $post_id);
    	}
    
    }

    I want the user to be able to see the Base64 output but not interact with it. So have added some backend CSS styles to the output field to disable the cursor and show the field at 50% opacity.

    Thanks again for your help. Will mark as solved 👍

  • Many thanks for the quick reply John.

    This seems like a great solution thanks. Will attempt this now and report back 🙌

  • I’ve been having the same issue. The developer has mentioned on the GitHub repository that he will be updating the plugin today hopefully. More updates here… https://github.com/funkjedi/acf-qtranslate/issues/103

Viewing 3 posts - 1 through 3 (of 3 total)