function generate_openai_audio_on_publish($post_id) { if (get_post_type($post_id) !== 'post') return; $post = get_post($post_id); $text = wp_strip_all_tags($post->post_content); $text = mb_substr($text, 0, 4000); // Limit text length $api_key = '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'; // Replace with your real key $voice = 'nova'; // voice option $response = wp_remote_post('https://api.openai.com/v1/audio/speech', [ 'headers' => [ 'Authorization' => 'Bearer ' . $api_key, 'Content-Type' => 'application/json' ], 'body' => json_encode([ 'model' => 'tts-1', 'voice' => $voice, 'input' => $text ]) ]); if (is_wp_error($response)) return; $body = wp_remote_retrieve_body($response); $data = json_decode($body, true); if (!$data || empty($data['audio_url'])) return; $audio_url = $data['audio_url']; // Download audio file from OpenAI $audio_response = wp_remote_get($audio_url); if (is_wp_error($audio_response)) return; $audio_content = wp_remote_retrieve_body($audio_response); if (!$audio_content) return; // Save the audio file to uploads folder $upload = wp_upload_bits("post-{$post_id}.mp3", null, $audio_content); if ($upload['error']) return; // Save URL in post meta for later retrieval update_post_meta($post_id, '_openai_audio_url', $upload['url']); } DA chief: NIA’s transfer to OP ‘strategic, possibly game-changing’ - newslineph.press

DA chief: NIA’s transfer to OP ‘strategic, possibly game-changing’

0

MANILA – Agriculture Secretary Francisco Tiu Laurel Jr. on Tuesday lauded the move of President Ferdinand R. Marcos Jr.’s move to revert the National Irrigation Administration (NIA) supervision to the Office of the President (OP).

“Under normal circumstances, NIA should be under the DA. However, given the urgent need to irrigate over a million hectares of land to boost agricultural productivity, especially for rice, President Marcos made a strategic – possibly a game-changing – move that would ensure that NIA receives the substantial funding necessary to fulfill this crucial mandate swiftly,” Tiu Laurel said in a statement.

He noted the urgency of securing more funds for NIA to irrigate about 1.2 million hectares of land, which may be feasible under the streamlined allocation of additional resources under the OP.

The DA proposed a PHP512 billion fund for fiscal year 2025, with higher proposed allocations for NIA’s irrigation projects.

The Department of Budget and Management (DBM), however, submitted to Congress a reduced budget proposal of PHP200.2 billion.

In the long run, Tiu Laurel said the President’s move would help “expedite” the implementation of irrigation infrastructure projects, which intends to achieve food security and drop reliance on importation. (PNA) 

About The Author

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © All rights reserved. | CoverNews by AF themes.