correct way to display image from php onto page <p>I am not getting my image correctly. I am unsure what is happening. First things first, the image is coming out of a mysql query. Little confused about how to make that image ready for a ajax call?</p> <p>here is how I get the image out mysql</p> <pre><code> if(mysql_query("insert into Personal_Photos (Email, Pics) values('$email', '$data')")) { $query="select Pics, MAX(ID) from Personal_Photos where Email='$email'"; $result=mysql_query($query) or die("Error: ".mysql_error()); $row=mysql_fetch_array($result); //$mime = 'image/yourtype'; //$base64 = base64_encode($contents); //$uri = "data:$mime;base64,$base64"; //header("Content-type: image/jpg"); echo '&lt;img src="data:image/jpeg;base64'.base64_encode($row['Pics']).'"/&gt;'; } </code></pre> <p>the jquery that I use is like so</p> <pre><code>$('#profilepicbutton').live('change', function(){ $("#preview").html(''); $("#preview").html('&lt;img src="loader.gif" alt="Uploading...."/&gt;'); $("#registerpt3").ajaxForm({ target: '#preview', success: function(data) { $("#preview").html(''); $("#preview").append(data); } }).submit(); }) </code></pre>