Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

displaying an image of type TIF

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
can any one advice on how to display an image of type TIF in a jsp

Thanks
santhosh
[ November 26, 2008: Message edited by: santosh raveendran ]
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
JSPs dont display images - they write HTML tags that tell the client browser where to get the image in a separate request/response cycle.

Get your image display working with static HTML tags first, then figure out how to get JSP to write that tag.

Bill
 
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Few (No ?) browsers can display TIFF out of the box. There's a plugin called http://www.alternatiff.com/ but it only works on Windows.

Maybe a better approach would be to convert the TIFF to something more universal -like PNG-, and serve that instead?
 
Santosh Raveendran
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
William,Ulf

I have implemented the below solution for displaying the image of extension tiff.

Struts implementation

public ActionForward execute(ActionMapping map, ActionForm form,HttpServletRequest request,
HttpServletResponse res) throws Exception {
System.out.println("Inside TiffFileDisplayAction");

FileInputStream inputStream;
byte[] buf = new byte[512 * 1024]; // 512K buffer
try {
//File file=new File("D://avinash//ss.pdf");
//inputStream=new FileInputStream(file);
//byte[] buf=new byte[inputStream.available()];
//inputStream.read(buf);

//String fileNames = "Example.pdf"; //(String) request.getParameter("fileNames");
//String fileExtension = fileNames.substring(fileNames.lastIndexOf('.')+1);
//inputStream = new FileInputStream("E://TifImage//Example.pdf");
inputStream = new FileInputStream("E://TifImage//Sample.tif");
//byte buf[]=new byte[1024];
int len;
res.setContentType("application/tiff");
res.setContentLength(buf.length);
//res.setHeader("Pragma", "no-cache");
res.setHeader( "Content-Disposition", "inline; filename=Sample.tif");
ServletOutputStream out = res.getOutputStream();
//out.write(buf, 0, buf.length);
while((len=inputStream.read(buf))>0)
out.write(buf,0,len);
out.close();

//buf = centeraService.retrieveFileFromCoupon(clipArtID);
//showPDFForScreen(buf,fileExtension);
//showPDFForScreen(buf,fileNames,fileExtension.trim(),res);

} catch (Exception e) {
e.printStackTrace();
}
return map.findForward("success");
}


Thanks
santhosh
 
Your mother was a hamster and your father was a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic