Skip to main content

developerWorks >  WebSphere  >  Forums  >  WebSphere JavaServer Faces (JSF)  >  developerWorks

hx:graphicImageEx displaying images represented by byte array    Point your RSS reader here for a feed of the latest messages in this thread


Tags for this thread: 

     

 
 

My developerWorks
 Welcome, Guest
Sign in or register
This question is not answered.

Permlink Replies: 1 - Pages: 1 - Last Post: Nov 7, 2009 7:28 AM Last Post By: bandreas
mabdelmonem

Posts: 2
Registered: Nov 07, 2009 04:39:43 AM
hx:graphicImageEx displaying images represented by byte array
Posted: Nov 07, 2009 05:34:17 AM
 
Click to report abuse...   Click to reply to this thread Reply
I'm trying to display a list of images using hx:graphicImageEx and h:dataTable components.

<h:dataTable value="#{signature.imageList}" var="signatureImage">
	<h:column>		                      	
		 <hx:graphicImageEx   value="#{signatureImage.data}" mimeType="image/*" />
		 <h:outputText value="#{signatureImage.data[0]}"/>
                 <hx:graphicImageEx   value="#{signature.imageList[0].data}" mimeType="image/*"  />
	</h:column>
</h:dataTable>


#{signature.imageList} represents an arraylist of type Image

public class Image {
	
	private String id;
	private String type;
	private byte[] data;
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public byte[] getData() {		
		return data;
	}
	public void setData(byte[] data) {
		this.data = data;
	}
}


The problem is with

<hx:graphicImageEx   value="#{signatureImage.data}" mimeType="image/*" />


which doesn't display the image represented by byte array .

The strange point is that:

<h:outputText value="#{signatureImage.data[0]}"/>

displays the first byte of the byte array correctly !

and

<hx:graphicImageEx   value="#{signature.imageList[0].data}" mimeType="image/*"  />

displays the first image of the image list correctly !

I don't know if the issue is with the data table or with hx:graphicImageEx !

Please help, I would appreciate any help from you

Thanks
{code}

bandreas

Posts: 1,472
Registered: Sep 07, 2004 02:56:32 PM
Re: hx:graphicImageEx displaying images represented by byte array
Posted: Nov 07, 2009 07:28:44 AM   in response to: mabdelmonem in response to: mabdelmonem's post
 
Click to report abuse...   Click to reply to this thread Reply
The mimeType used with an hx:graphicImageEx has to specify the type of the image so the browser knows how to interpret the bits. For example it should be "image/gif" or "image/png" or "image/jpeg" not "image/*".
 Tags
Help

Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular type of content or application that you're viewing.

My tags shows your tags for this particular type of content or application that you're viewing.

 

MoreLess 


Point your RSS reader here for a feed of the latest messages in all forums