Hi,
I have an image, in JPEG format, stored inside a byte array.
I have to render that image. I will not be able to open a file
connection and write that image to HDD, either on client side or on
server side. So my query is this, how do I render an image which is
stored as a series of bytes? I have tried out.println and IMG tag, but
they do not work.
Any help would be appreciated
Bye
Amardeep Verma 6 21753
presumably your JSP page is currently producing HTML. HTML cannot contain
image data in the file itself, only through an external href.
so the best option would be to generate an <img> tag in your JSP which
contains a URL to a different JSP (or the same jsp with different
parameters). When the browser requests the image, you can send the binary
data as content type image/jpeg.
Andy
"Amardeep Verma" <ad******@email .com> wrote in message
news:1a******** *************** ***@posting.goo gle.com... Hi, I have an image, in JPEG format, stored inside a byte array. I have to render that image. I will not be able to open a file connection and write that image to HDD, either on client side or on server side. So my query is this, how do I render an image which is stored as a series of bytes? I have tried out.println and IMG tag, but they do not work.
Any help would be appreciated
Bye Amardeep Verma
"Amardeep Verma" <ad******@email .com> wrote in message
news:1a******** *************** ***@posting.goo gle.com... Hi, I have an image, in JPEG format, stored inside a byte array. I have to render that image. I will not be able to open a file connection and write that image to HDD, either on client side or on server side. So my query is this, how do I render an image which is stored as a series of bytes? I have tried out.println and IMG tag, but they do not work.
I haven't tried this, but my guess is that you could include a tag like this
in your html: <img src="myimage.js p">. Then have myimage.jsp return the byte
data. Be sure to set the http response header to indicate that it's a jpeg.
Chris wrote: "Amardeep Verma" <ad******@email .com> wrote in message news:1a******** *************** ***@posting.goo gle.com...
Hi, I have an image, in JPEG format, stored inside a byte array. I have to render that image. I will not be able to open a file connection and write that image to HDD, either on client side or on server side. So my query is this, how do I render an image which is stored as a series of bytes? I have tried out.println and IMG tag, but they do not work.
I haven't tried this, but my guess is that you could include a tag like this in your html: <img src="myimage.js p">. Then have myimage.jsp return the byte data. Be sure to set the http response header to indicate that it's a jpeg.
FYI, since JSPs implicitly open the output stream as a character stream
and the specification prohibits one from re-opening it as a byte stream,
this is best done from a servlet instead of a JSP.
Ray
Allen E. Scharfenberg wrote: I think you can set the MIME type you are returning in both servlets and JSP. SO, you could set the MIME type being returned to image\jpeg or whatever, convert the byte[] to a character[], and then just slam it through.
No; you can set the MIME type if you like, but a JSP is only allowed to
return character data. There was a tech tip from Sun a while back that
dealt with this very issue. The original tip suggested using JSPs, but
the next tip made the correction. In fact, I just found the tip in my
email library; it wasd the tech tip for 8/21/2001.
Here are the links: http://developer.java.sun.com/develo...01/tt0821.html http://developer.java.sun.com/develo...21_update.html
Ray
Allen E. Scharfenberg wrote:[color=blue]
> I think you can set the MIME type you are returning in both servlets and
> JSP. SO, you could set the MIME type being returned to image\jpeg or
> whatever, convert the byte[] to a character[], and then just slam it
> through.
>[/color]
No; you can set the MIME type if you like, but a JSP is only allowed to
return character data. There was a tech tip from Sun a while back that
dealt with this very issue. The original tip suggested using JSPs, but
the next tip made the correction. In fact, I just found the tip in my
email library; it wasd the tech tip for 8/21/2001.
Here are the links: http://developer.java.sun.com/develo...01/tt0821.html http://developer.java.sun.com/develo...21_update.html
Ray
Hi Ray
Thanks a lot. You solved my problem. I was thinking along the same lines on setting the mime type on jsp response. These URLs showed how to do it exactly.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gregory |
last post by:
Hello,
I've managed to build two web pages, one that can display images with
associated text data in a table, and one that can resize and display images
without the text. I'd like to resize the images as I go, without writing
them to disk on the server. Do I need to prepare all of the resized images
before I display the data from the select (which is put into an array by
php). How can I display a resized image in a table, without writing...
|
by: Dalan |
last post by:
At first I was not certain what could cause Access 97 from displaying
most jpeg images, but not all. After further testing, it seemed that
all original images of less than 275 pixels per inch or less would
display, but those close to 300 pixels/inch or greater would not (MS
Access cannot recognize the file format xxx.jpg). The larger, original
images were scanned and saved as .bmp (at 300 dpi producing a 15MB
file). Then the images were...
|
by: marvin |
last post by:
Hi,
I am trying to display images in a repeater from a SQL database and do
some transformations on the image prior to displaying them (such as
thumbnail with a shadow). The problem is I can't seem to get the data
passed to the handler.
The following is the code that I have so far.
In the ViewPics.aspx file I have...
|
by: CD |
last post by:
An application is logging faxes sent in SQL2000 image column type. I have
found code on the net but what it is doing is prompting to save to local
which is fine for single page image. Not good for multiple page faxes. I
have not been able to locate an example to load in the browser or how to
handle multiple image in the one column.
1) Ideally it would be nice to display back in the browser since some may be
multiple images. I am not...
|
by: ljuljacka |
last post by:
I'm trying to display resized images. Locations of images are fetched from
database. The problem is that with the following code, I get only the first
image displayed:
<?php
header('Content-type: image/jpeg');
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
| |
by: redpears007 |
last post by:
Hi Again,
Throwing this one out to you again as i am not getting anywhere and
can find little to no information out there.
I am currently displaying images (Jpegs) in access via the routine set
up in the article http://support.microsoft.com/kb/285820/en-us. It
works fine if the image is under 1000x1000 pixels. It is set up so
the user can double click to open the image in its host application.
|
by: littlealex |
last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS!
In IE6 the text for the following page doesn't display properly - rather than being aligned to the top, along with the slideshow and link buttons, you have to scroll down to see the text - how can I make IE6 display correctly?
http://geekarama.co.uk/new_home.html
here is the code for new_home.html and following that the CSS...
|
by: shahidrasul |
last post by:
i display a pic on picture box and then i want to display another pic after some seconds
but problem is that first image is not displaying only display 2nd image
1... display first picture from database such as
pbThumbImage.Image = new Bitmap(new MemoryStream(objEmployee.Picture));
2... and then get the reference of current main thread
Thread main = Thread.CurrentThread;
Thread.Sleep(5000);
|
by: Jeff |
last post by:
hi
asp.net 2.0
I have a image (.jpeg) stored in sql server 2005 and now I want to display
it on a webpage.
So I created a webpage (Image.aspx) which just writes the buffer data to the
Response object.
On Default.aspx I use this Image.aspx for displaying the image, but no image
|
by: mvijayrkumar |
last post by:
Hi to all....
Guys pls help me.....
I have an image issue in RLDC while hosting my project on server.The image displays or works fine with the local system.But when hosted on server,both the images(One coming from DataSet and another from my project image folder) not displaying.
Both images are having Type property External and the Values are given correspondingly.ie The One coming from Image Folder;using the Report Parameter ,the...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |