2
I’m trying with the PHP GD library, like this:
<?php
$con = oci_connect('root', '123', '172.16.1.100/DB');
$stmt = oci_parse($con, "SELECT Nome, Imagem FROM Tabela where ID = '1'");
oci_execute($stmt);
$row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS);
if (!$row) {
header('Status: 404 Not Found');
} else {
$assinatura = $row['IMAGEM'];
header("Content-type: image/png");
$imagem = imagecreatefrompng($assinatura);
imagepng($imagem,"img-".$row['NOME'].".png");
imagedestroy($imagem);
}
?>
But not saved. If I give a print $signature it appears the picture straight.
It shouldn’t be that, but try without the
imagedestroy($imagem);
.– Andrei Coelho
It didn’t work either @Andreicoelho
– Ramon Ribeiro
What comes from the bank is already the contents of the file? Don’t you do any manipulation? If yes, then you don’t need the GD library, you can directly save the binary file using file_put_contents for example.
– Júlio Neto
It comes in several special characters @Júlioneto, if only to pick up the Base and show me up with you. However, I would like to take the image of the Oracle Base and save it in one location only to save the path of it in another Base.
– Ramon Ribeiro
It is strange that this code does not work. Mainly because you managed to print the image... With the
var_dump(imagepng($imagem,"img-".$row['NOME'].".png"));
returns what?– Andrei Coelho
I misread the statement when I give
print $assinatura
it shows the image instead of the$imagem
.. thevar_dump()
returnednull
in$imagem
and in$assinatura
retorna '�PNG

���
IHDR�������:���_��0���IDATx��GoA��/wD�b2�"��E'rGD�Y9�Ӊ�A�F_K�j�ݳ;����[%Y������ͫW�=n7�>' e isso continua.. @Andreicoelho– Ramon Ribeiro
This removing the
header("Content-type: image/png")
not to try to print some image.– Ramon Ribeiro