Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Unsupported or unrecognized format - While converting blob to image (Unsupported or unrecognized format - While converting blob to image )
Unsupported or unrecognized format - While converting blob to image [message #496040] Sat, 07 November 2009 13:48
govind Ra is currently offline govind RaFriend
Messages: 95
Registered: July 2009
Member
Hello All

I am using mysql for storing image using LongBlob as datatype.

/// take the image path for getting contents.

String contents = null;
BufferedReader bReader = new BufferedReader(new FileReader(imagePath));
String str;
while ((str = bReader.readLine()) != null) {
contents = contents + str.trim();
}
if(contents!=null){
byte[] bytes = contents.getBytes();
return bytes;
}

Saving to db the new String(bytes)

//// getthing the image contents

blob contents to bytes

InputStream resourceAsStream = this.getClass().getResourceAsStream(bytes);
ImageData imageData = new ImageData(resourceAsStream);
Image image = new Image(Display.getDefault(),resourceAsStream);
pictureLabel.setBackgroundImage(image);

Can any help me .

Regards
Govind R




Previous Topic:[Draw2D] turning on advanced graphics
Next Topic:Disable Tab Item
Goto Forum:
  


Current Time: Fri Apr 26 21:54:00 GMT 2024

Powered by FUDForum. Page generated in 0.02969 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top