Inserting and displaying blob image
-
Hi, I’m new to developing with wordpress.
I have a form where I upload to an image database, but when I try to display the image, does not work.This is the code where I insert the image to the database:
<?php global $wpdb; $image = addslashes(file_get_contents($_FILES['file']['tmp_name'])); $wpdb->insert('image' => $image); ?>
And, this is the code where I try display the image:
<?php global $wpdb; $get_image = $wpdb->get_row("SELECT image FROM clientes WHERE id = 1"); $image = $get_image->image; echo '<img src="data:image/jpeg;base64,'.base64_encode($contenido_foto).'">'; ?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Inserting and displaying blob image’ is closed to new replies.