我正在开发一个读取人脸图像,识别并希望显示结果弹出窗口的应用。但是代码没有显示弹出窗口。
弹出功能:
<?php
add_filter( 'upload_dir', 'wpse_183245_upload_dir' );
function wpse_183245_upload_dir( $dirs ) {
$dirs['subdir'] = '/up';
$dirs['path'] = $dirs['basedir'] . '/up';
$dirs['url'] = $dirs['baseurl'] . '/up';
return $dirs;
}
$upload_dir = wp_upload_dir();
$user_dirname = $upload_dir['basedir'] . '/' . 'up';
if(!file_exists($user_dirname)) wp_mkdir_p($user_dirname);
$upload = wp_upload_dir();
$upload_dir = $upload['basedir'] . $directory_path;
$permissions = 0755;
$oldmask = umask(0);
if (!is_dir($upload_dir)) mkdir($upload_dir, $permissions);
$umask = umask($oldmask);
$chmod = chmod($upload_dir, $permissions);
add_action('admin_menu', 'custom_menu');
function custom_menu() {
add_menu_page(
'Page Title',
'File Upload',
'upload_files',
'menu_slug',
'my_admin_page_contents',
'dashicons-media-spreadsheet'
);
}
function ada(){
$upload_dir = wp_upload_dir();
$user_dirname = $upload_dir['basedir'] . '/' . 'up';
}
function my_admin_page_contents() {
?>
<h1>
<form enctype="multipart/form-data" action="#" method="POST">
Please choose a file: <input name="file" type="file" /><br />
<input type="submit" value="Upload" name="submit" />
</form>
</h1>
<?php
}
if(isset($_POST['submit'])){
if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' );
//add_filter( 'upload_dir');
$uploadedfile = $_FILES['file'];
$upload_overrides = array( 'test_form' => false );
$movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
if ( $movefile ) {
echo "File is valid, and was successfully uploaded.\n";
//var_dump( $movefile);
} else {
echo "Possible file upload attack!\n";
}
}
require_once( ABSPATH . 'wp-admin/includes/file.php' );
echo list_files( $folder = '', $levels = 100, $exclusions = array() );
?>
def popup_win(status):
layout = GridLayout(cols=1, padding=10)
label = Label(text="Authenticated") if status else Label(text="Not Identified")
layout.add_widget(label)
closeButton = Button(text="OK", font_size=30, background_color=(0, 0, 0, 0))
layout.add_widget(closeButton)
# Instantiate the modal popup and display
popup = Popup(title=' ', content=layout, size_hint=(None, None), size=(150, 150),auto_dismiss=True)
print("[INFO] Popping UP")
popup.open()
popup.dismiss()
cv2.waitKey(10)
# Attach close button press with popup.dismiss action
closeButton.bind(on_press=popup.dismiss)
return