Share on Google+Share on Google+

suresh
thumbnails
1 Answer(s)      8 years ago
Posted in : JSP-Servlet

Ads

View Answers

December 30, 2008 at 1:13 AM


Hi friend,


package javacode;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.awt.*;
import java.awt.image.*;
import javax.imageio.*;

public class ImageServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res){
//Set the mime type of the image
res.setContentType("image/jpeg");

try {
// Create an image 200 x 200
BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);

//Draw an oval
Graphics g = bufferedImage.getGraphics();
g.setColor(Color.blue);
g.fillOval(0, 0, 199,199);

// Free graphic resources
g.dispose();

ImageIO.write(bufferedImage, "jpg", res.getOutputStream());
}
catch (IOException ioe)
{
System.out.println("error found" + ioe);
}
}
}

------------------------------------------

<servlet>
<servlet-name>imageServlet</servlet-name>
<servlet-class>javacode.ImageServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>imageServlet</servlet-name>
<url-pattern>/jsp/ImageServlet</url-pattern>
</servlet-mapping>

-----------------------------------------

Visit for more information.

http://www.roseindia.net/servlers/

Thanks.









Related Tutorials/Questions & Answers:
thumbnails - JSP-Servlet
thumbnails  how to create thumbnails using servlets?  Hi friend, package javacode; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.awt.*; import
Eclipse Plunging-Graphics
by one, or as thumbnails. Use the toolbar to navigate or by single- or double
Advertisements
java (jquery) - Java Beginners
links) the thumbnails at bottom to be like imageflow (the second links)... ie. to put a big preview to the image flow which is at bottom as thumbnails
QuickImage 0.2.0
QuickImage 0.2.0       The QuickImage plugin provides an eclipse-editor for viewing images. You can browse images one by one, or all as thumbnails. Use the toolbar
About PHP GD
, WBMP, and XPM etc. We can generate charts, graphics, thumbnails, etc. It can do.... Generate charts, graphics, thumbnails, etc It supports different image formats
How to use flickr image in Flex
smoothing to true on the images so the thumbnails don?t look as pixelated
Displaying images using Javascript
="strip_of_thumbnails">   <div>  ...;class="strip_of_thumbnails">   <div><a href...;   <div class="strip_of_thumbnails">   <
how to featch data form db?
;'; //+'' +''+''; $('.thumbnails').append(li...;'+'</div></li>'; $('.thumbnails').append(li...;/div></li>'; $('.thumbnails').append(li
PHP Introduction
. phpThumb Use this library to generate thumbnails in your PHP program
ActionScriptTutorials
that will be used as our thumbnails. We also created larger .swf movies for each
Python Programming Books
processing applications. You can use the library to create thumbnails, convert
Tutorials   
Java Spring Hibernate Struts Training fat image from db fat image from db fat image from db fat image from db unable to get value returned from javascript variable in page How to change image size before adding to mysql using jsp Design a registration.jsp page with input for user registration details Cart Quantity jsp servlet coding issue servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? image pdf marking pdf marking Multiple image upload using JSP Read code from excel sheet and upload into database using JSP Student java about search engine Convert BLOB to PDF and save it to a location how to copy files from remote to local machine using SFTP SSL in java? Like Team viewer Socket and Servert -Jsp how to copy files from remote location to local using java? How To Store Multilple Images In MySQL database dynamically with image uploader and then retrieve them in image gallery using java how to create SOAP based web service in java? how to fetch data from mysql database table and draw a bar chart on that data using in jsp how to create users in LDAP using java? how to authenticate user using TIVOLI api in java? how to create users using IBM Tivoi API in jsp/servelet? Java/J2ee Please explain this code as many packages and classes are unknown to me .! how to download the uploaded folder files using jsp Login Query image is display from path of mysql database please reply the code to store dynamic fields in database? Reloading issue in jsp How to get Button Id ? calling one jap page from another jsp page login login Problem to get connection from DAO class to JDBC Page Loading Time Fix table's column's name row(1st row of the table) so that it does not move up when the table is scrolled up to view more rows below Sending hidden values

Ads

 
Advertisement null

Ads