PDA

View Full Version : modifiche al codice PHP annullate


chiocciola31
20-01-2023, 10:00
dovrei inserire questo codice /**
* Filter hook & function for outputs a PNG image file */
*
* @param string $image_data image_data.
* @param string $name name.
* @param string $form_value form_value.
* @param string $form_value2 form_value2.
* @param string $form_value3 form_value3.
*/
function canvas_save( $image_data, $name, $form_value, $form_value2, $form_value3 ) {
$wp_uploads = wp_upload_dir();
$relation_path_true = strpos( $wp_uploads['baseurl'], '../' );
if ( $relation_path_true > 0 ) {
$upload_dir = wp_normalize_path( realpath( $wp_uploads['basedir'] ) );
} else {
$upload_dir = wp_normalize_path( $wp_uploads['basedir'] );
}
$filename = $upload_dir . '/' . $name . '.png';
$image = imagecreatefromstring( $image_data );
imagepng( $image, $filename );
}
add_filter( 'free_canvas_save', 'canvas_save', 10, 5 );

che sarebbe un filter hook da inserire nel file function.php di wordpress per far funzionare un plugin (free canvas) Solo che mi dice ---Le tue modifiche al codice PHP sono state annullate a causa di un errore alla linea 3 syntax error, unexpected '*', expecting end of file Mi potreste aiutare a capire dov'e' l'errore?

x_Master_x
20-01-2023, 13:10
Il commento si chiude dove non dovrebbe

/**
* Filter hook & function for outputs a PNG image file */
*
* @param string $image_data image_data.
* @param string $name name.
* @param string $form_value form_value.
* @param string $form_value2 form_value2.
* @param string $form_value3 form_value3.
*/

Va messo cosė:

/**
* Filter hook & function for outputs a PNG image file
*
* @param string $image_data image_data.
* @param string $name name.
* @param string $form_value form_value.
* @param string $form_value2 form_value2.
* @param string $form_value3 form_value3.
*/

chiocciola31
20-01-2023, 18:07
Il commento si chiude dove non dovrebbe

/**

funziona grazie davvero non so come ringraziare