0

I am using JQuery Line Control Plugin for textbox, which include both images links text(which can be styled in either format) and it is proving me the html code for that which saves in MySQL database.

For Example :

If in Line Control Textbox I insert an image and a paragraph it saves in MySQL the below result

    <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4RDgRXhpZgAATU0AKgAAAAgABAE7AAIAAAAHAAAISodpAAQAAAABAAAIUpydAAEAAAAOAAAQyuocAAcAAAgMAAAAPgAAAAAc6gAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...and a lonbg garbage text like this" alt="" height="151" width="139"/>
<br><br>Summis cernantur possumus, sunt arbitror ea comprehenderit, ne multos quibusdam &lt;br&gt;distinguantur de multos est cernantur e e laborum arbitrantur do dolor e &lt;br&gt;excepteur iis laborum fugiat fabulas si nescius quem nostrud vidisse. Labore &lt;br&gt;pariatur in praetermissum qui laborum quem nam <br>

How can I show it in php page with the image ?

I know JQuery also so the solution with jquery will also accepted.

1 Answers1

0

You may need to change this according to your filetype.

header("Content-Type: image/jpeg");
$data = "/9j/4AADADJdjw8A........and so on"; // Get this from somewhere
echo '<img src="data:image/jpeg;base64,' . $data . '" />'; // To Display the image

EDIT: Your Base64 image code is probably damaged. I ran your code in JSFiddle with another image and it works just fine. Maybe you should check whether your Base64 data is being truncated by the database.

Titanoboa
  • 355
  • 1
  • 9