Does anyone know how to extract BLOB type images stored in a MySQL table and convert them to .png, to store them in a folder?
The following code extracts the image of the "200x150" field from the "img_alq" table and displays it on the screen:
<?php
header("Content-type: image/png");
if(isset($_GET['id'])){
$id = $_GET['id'];
$link = mysql_connect("localhost", "root", "") or die ("ERROR AL CONECTAR");
$db_select = mysql_select_db('claromec_restore') or die ("ERROR al seleccionar la BD");
$sql = "SELECT *
FROM 'img_alq'
WHERE 'idalq' = $id
ORDER BY 'idalq' ASC, 'orden' ASC, 'id' ASC";
$result = mysql_query($sql, $link) or die ("Error al consultar");
while ($row = mysql_fetch_assoc($result)) {
echo $row["200x150"];
}
mysql_free_result($result);
} else {
echo 'NO hay ID';
}
?>