Re: OT-Exibir un 'byte[] imgBytes' via JSP
От | Marcus Andree S. Magalhaes |
---|---|
Тема | Re: OT-Exibir un 'byte[] imgBytes' via JSP |
Дата | |
Msg-id | 64779.200.171.169.116.1130780477.squirrel@200.171.169.116 обсуждение исходный текст |
Ответ на | OT-Exibir un "byte[] imgBytes" via JSP (<sandrigo.lezcano@gmail.com>) |
Список | pgsql-jdbc |
I believe you can have much better support in this list if you post in English. Since I do speak Portuguese, I'm providing some help and a translation of my answer to English as well. You need to write your memory-based image to a temporary file, and update the IMG SRC tag properly. For instance, suppose you have a domain called 'www.mysite.com' and a temporary directory for writing, '/temp_files' on the root directory of your web server. Step 1: create a unique and temporary file name, say 'temp0001.jpg' Step 2: 'dump' the content of your image to a file, from whatever structure you've used to store it. Use the file name generated on step 1 Step 3: use the unique file name to build the IMG SRC tag. Ex: <IMG SRC="http://www.mysite.com/temp_files/temp0001.jpg"></img> Step 4: use an external program/component to "clean" the temp_files directory on a periodic basis. It's possible, but rather messy to use the same script to delete the file once it's viewed by the user/client. You may find a lot easier to store the files holding the images on a database, instead of storing the images themselves. If you have any further doubt, please contact me directly, as this post is OT. ------------------------------------------------------------------------ Voce precisa escrever a sua imagem armazenada em memoria em um arquivo temporario, e atualizar o tag IMG SRC aequadamente. Por exemplo, suponha que voce tem um dominio chamado 'www.mysite.com' e um diretorio temporario para escrita, '/temp_files' no diretorio raiz do servidor web. Passo 1: crie um nome de arquivo unico e temporario, digamos 'temp0001.jpg' Passo 2: copie o conteudo da sua imagem para um arquivo, de qualquer que seja a estrutura que voce usou para armazena-la. Use o nome de arquivo gerado no passo 1 Passo 3: use o nome unico de arquivo bara construir o tag IMG SRC. Ex: <IMG SRC="http://www.mysite.com/temp_files/temp0001.jpg"></img> Passo 4: use um programa/componente externo para "limpar" o diretorio temp_files periodicamente. E' possivel, mas deselegante, usar o mesmo script para deletar o arquivo uma vez que ele ja tenha sido visto pelo usuario/cliente. Voce podera achar muito mais pratico e facil armazenar os nomes dos arquivos contendo as imagens no banco, ao inves de armazenar as imagens propriamente ditas. > perdon por el OT.. > pero ya he buscado bastante por el tema > e no puedo encontrar o enteder como > puedo a partir de tener mi imagem > en memoria, incluirlo dentro de um > HTML <IMG SRC=> tag ? via JSP > > del manual (http://www.javalinux.com.br/pg74/jdbc-binary-data.html) > > ps.setString(1, "minha_imagem.jpg"); > ResultSet rs = ps.executeQuery(); > if (rs != null) { > while (rs.next()) { > byte[] imgBytes = rs.getBytes(1); > // como a partir de esto puedo montar mi HTML ?? > } > rs.close(); > } > ps.close( > > Cualquier ayuda me biene bien.. > > Perdon por el OT > Att > -- > _______________________________________ > sandrigo.lezcano@gmail.com ICQ:143590717 > RUA INDEPENDENCIA 135 - BOA VISTA > CEP 06411-050 - Barueri/SP/Brazil > FONE 11 4198-1095 > Vip-Systems Informatica > http://www.vip-systems.com.br > =============================---------------------------(end of > broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq >
В списке pgsql-jdbc по дате отправления: