I have a php function which is called by a jquery function. This jquery function will essentially place the picture on the page. I am having a hard time getting this to work right. I am trying to pin down where he problem might lie… My current line of thinking is that I am not sending the data back to my jquery function properly. Here is how I am getting the image
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);
echo '<img src="data:image/jpeg;base64'.base64_encode($row['Pics']).'"/>';
}
The key line is right here…
echo '<img src="data:image/jpeg;base64,'.base64_encode($row['Pics']).'"/>';
I am wondering if I am doing that incorrectly? How do you do it? Is there a better way to do it. If you notice anything else wrong with my code, I would definitely appreciate the criticism.
You need a comma after the
base64, which your code block doesn’t appear to have (though your individual line you posted has it). Which way is it in your real code?