Create a new TIFF node automatically
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2009 08:05 AM
Good morning all
We are creating a wizard that would produce a new "jpg" node and we will add to it some image content. To do this we apply this code:
However we would need to produce a node of type "TIFF" instead of "jpg" but we can not use the
Does anyone know a way to produce a new TIFF node as a result of a wizard… maybe transforming the jpg node produced to TIFF…but how?
Thanks a lot for your ideas in advance!
We are creating a wizard that would produce a new "jpg" node and we will add to it some image content. To do this we apply this code:
properties.put(ContentModel.PROP_CONTENT, new ContentData(null, MimetypeMap.MIMETYPE_IMAGE_JPEG, 0L, null));
However we would need to produce a node of type "TIFF" instead of "jpg" but we can not use the
MimetypeMap.MIMETYPE_IMAGE_TIFFas it does not exists
Does anyone know a way to produce a new TIFF node as a result of a wizard… maybe transforming the jpg node produced to TIFF…but how?
Thanks a lot for your ideas in advance!
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2009 08:14 AM
It's not a complete solution, but the second parameter of the ContentData() constructor is just a string, so you can pass in "image/tiff" directly.
Thanks,
Mike
Thanks,
Mike
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2009 12:10 PM
Hi Mike
Thanks a lot for the answer. After making those changes I am able to produce a new TIFF node, however when I try to add the image conent to the node it fails. I mean I can see a node_name.tif in the repository of alfresco, but the content is empty.
I think it is in this section:
I am not sure if the function ImageIO.write allow us to introduce the "tiff" parameter or it is restricted to "jpg", "png","GIF". Do you know a better idea to transform a java.awt.Image in an Alfresco TIFF node?
Cheers
Thanks a lot for the answer. After making those changes I am able to produce a new TIFF node, however when I try to add the image conent to the node it fails. I mean I can see a node_name.tif in the repository of alfresco, but the content is empty.
I think it is in this section:
File outputfile = File.createTempFile("file", "aux"); outputfile.createNewFile(); ImageIO.write(Image_Content, "tiff", outputfile); ContentWriter writer2 = getContentService().getWriter(this.newNodeRecorte.getNodeRef(), ContentModel.PROP_CONTENT, true); // set the mimetype and encoding writer2.setMimetype("image/tiff"); writer2.setEncoding("UTF-8"); writer2.putContent(outputfile); // Destruimolo ficheiro final outputfile.delete();
I am not sure if the function ImageIO.write allow us to introduce the "tiff" parameter or it is restricted to "jpg", "png","GIF". Do you know a better idea to transform a java.awt.Image in an Alfresco TIFF node?
Cheers
