Hi everybody
I need put a image from my database over a view but I cant find how
can use the lo_import in cakephp, I find in the api all the functions
pg_ lo_ create
pg_ lo_ export
pg_ lo_ import
pg_ lo_ open
pg_ lo_ read_ all
pg_ lo_ read
pg_ lo_ seek
pg_ lo_ tell
pg_ lo_ unlink
pg_ lo_ write
but really I dont understand how can use it-- because is cakephp how
connect over the database and in natural php this is the normal use of
the last functions
<?php
// realiza la conexión a la base de datos
// $dbConnStr es una cadena que contiene la información
necesaria
para realizar la
// conexión a la base de datos, que puede ser algo como:
// "dbname=<nombre_de_la_db>
user=<nombre_del_usuario_en_postgres>
password=<clave_del_usuario_en_postgres>"
$conn = pg_connect($dbConnStr);
if (!$conn) {
exit;
}else{
// el browser pensará que este archivo es una imagen PNG
header('Content-type: image/png');
// el uso de pg_lo_open debe estar dentro de una
transacción, asi
que la iniciamos
pg_query ($conn, 'begin');
// abre el BLOB
$loid = pg_lo_open($conn,
$administrador['Administrador']['foto'],
'r');
// lee todo el contenido del blob (que es el contenido
de la
imagen) y se lo tira al browser
pg_lo_read_all ($loid);
// cierra el objeto
pg_lo_close ($loid);
// cierra la transacción
pg_query ($conn, "commit");
// cierra la conexión
pg_close();
}
?>
Someone know hoe can map the last code to code in cakephp
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---