Por: Gonzalo Escribano
procedure to return image web request
February 27, 2008
Este procedimiento permite devolver una imagen al request, inluso cambiando el mime type del response.
En este ejemplo se usa una imagen de otro sitio para hacer el request, y luego se la devuelve.
Create or Replace Package BODY GESCRIBANO.IMAGETEST
is
procedure show
is
l_blob blob;
begin
l_blob := utl_raw.cast_to_raw( utl_http.request(‘http://ichart.finance.yahoo.com/t?s=NBL’) );
owa_util.mime_header( ‘image/png’, FALSE );
htp.p( ‘Content-length: ‘ || dbms_lob.getlength( l_blob ) );
htp.p( ‘Content-Disposition: filename=”finance-yahoo-nbl.png”‘ );
owa_util.http_header_close;
wpg_docload.download_file( l_blob );
end SHOW;
end imagetest;