cancel
Showing results for 
Search instead for 
Did you mean: 

Get the Content from an Image File

jlabuelo
Champ on-the-rise
Champ on-the-rise
Good afternoon all

We are trying to get the Image from a content node we have in the alfresco repository. Lets say that we have a jpg file saved in our repository, so we need to get the image of that file and use it to create a new jpg file adding some other strings.

Basically the first error we find is that we are not able to obtain the Image from the existing jpg file:


Node Documento_Aux =  this.browseBean.getDocument();
File imagen_Original= null;
this.getFileFolderService().getReader(Documento_Aux.getNodeRef()).getContent(imagen_Original);

Our understanding is that the getContent() method should create a new file "Imagen_Original" with the image of the jpg node….however when we try to run it fails:
A system error happened during the operation: null

Any ideas of what we are doing wrong… or howwe can get the image of the jpg file in the repository as a Java Image Object??

Thanks a lot in advance
3 REPLIES 3

jlabuelo
Champ on-the-rise
Champ on-the-rise
Hello guys

anyone that can help us here? How can you move an Alfresco Node which is a "jpg" file to a Java.io.File to work with the Java.awt.Graphics class?

Thanks in advance

marcus
Champ in-the-making
Champ in-the-making
When you are calling .getContent(imagen_Original); you are passing in a null File object. You have to pass in an actual object here, which will get populated with the relevant content (perhaps look at File.createTempFile to get a temporary file object).

jlabuelo
Champ on-the-rise
Champ on-the-rise
Thanks a lot it worked fine!!