correct way to display image from php onto page

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?

here is how I get the image out mysql

    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 '<img src="data:image/jpeg;base64'.base64_encode($  row['Pics']).'"/>';
            }

the jquery that I use is like so

$  ('#profilepicbutton').live('change', function(){
    $  ("#preview").html('');
    $  ("#preview").html('<img src="loader.gif" alt="Uploading...."/>');
        $  ("#registerpt3").ajaxForm({
                target: '#preview',
                success: function(data)
                {
                    $  ("#preview").html('');
                    $  ("#preview").append(data);
                }
            }).submit();
 })

newest questions tagged jquery – Stack Overflow

About Admin