Hello I used to store my images as data. It looked something like "‰PNG IHDRÂæÉ0†"
. I was able to generate images from this data using the following code:
include_once "mysql_connect.php";
if(isset($_GET['id'])){
$id = mysql_real_escape_string($_GET['id']);
$query = mysql_query("SELECT * FROM `entree` WHERE `realID` = '$id'");
while($row = mysql_fetch_assoc($query)){
$imageData = $row["thumbXL"];
$imageType = $row["imageext"];
}
if($imageType == "image/png"){
header("content-type: image/png");
}else if($imageType == "image/jpeg"){
header("content-type: image/jpeg");
}else{}
if(!($imageData == null)){
echo $imageData;
}else{
}
}else{
}
That code was in a file called generateThumbnailXL.php and I would put that in the src of the images and the image would be generated perfectly. I switched to using Base64 image data recently and I just put the base64 data into the src and the image is generated perfectly. The problem is when someone shares my article on Facebook, the thumbnail doesn't show up because Facebook doesn't like using Base64. I need some way of converting base64 into something like "‰PNG IHDRÂæÉ0†"
and then echo it out like the way the above code did. How can I do this? I researched on Google and found little help, nothing that will work for me.