Good Afternoon, y'all!!
I have a database with a table containing a row with 4 columns called "ID", "login", "pass" and "image"(BLOB). I have a system with users authentication and etc, and I want to implement the image registered by the user to be shown in the topbar. Everything's working pretty well so far, the only problem is that the database image is printing like this:
ÿØÿàJFIF``ÿÛC %# , #&')*)-0-(0%()(ÿÛC (((((((((((((((((((((((((((((((((((((((((((((((((((
ÿÀ€€"ÿÄ ÿĵ}!1AQa"q2‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’
“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq"2B‘¡±Á #3R
ðbrÑ $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹º
Detail: When I open the image selected to the database in NOTEPAD, it's the same shown above.
IMAGE.PHP
include "dbconnection.php";
$defaultpath = "img/avatar.png";
$sql = "SELECT * FROM `bg_users`";
$query = mysql_query($sql);
$result = mysql_fetch_assoc($query);
if (!isset($_SESSION)) {
$_SESSION['UserImage'] = $result['image'];
print $_SESSION['UserImage'];
}
else {
echo "src='img/avatar.png'";
}
?>
Again, the interaction between PHP and MySQL is completly fine. The problem is that PHP is not printing the file as image. I can't make header("Content-type: image/png");
because the page i want to include image.php already have a header parameter.
Could't someone help me on this? I would be very pleased
Thank You!