Provide a canvas. Various cooperation is possible by shortcode and filter.
echo do_shortcode( '[freecanvas height=500]' );
/**
* 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 );
free-canvas
directory to the /wp-content/plugins/
directorynone
Modified admin screen.
Supported WordPress 5.6.
Fixed ajax.
Fixed sample code.
Add shortcode attributes of form name.
Modified documentation.
Add shortcode attributes of form name.
Suppress screen transition when clicking save button in form.
Corrected the description.
Change readme.txt.
Initial release.