on 08-19-2009 3:05 PM
Hi experts,
I have a requirement where an input excel file will have an image name, and all images are in a particular folder.
Is it possible to go to that folder and verify the properties..such as if image is more than 500 pixel, then throw error else continu with the mapping of the rest of the fields in the xl file?
I have searched a lot, I dont think its possible in PI runtime..
would any of u have any suggestions?
Hi Ravindra,
YOu can write a UDF to get the file size(which is directly proportional to your pixel count.
and raise an exception if it over a threshold value.
http://blog.codebeach.com/2007/05/get-size-of-file-in-java.html
But this approach works if the folder with the images is on XI server in which you are working.
Regards,
Ravi Kanth Talagana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
Thanx for ur reply..
the excel file is picked up from a folder, that has an image nam ein one column.
Then we have to go to that folder in PI runtime and see the pixel...
i got ur idea..but im struck on how i can do it in PI..
cos its one instance when a file gets picked, xl file so adapter module to read it...
then one field is image name...then how can i go to image size placed in anothe rfolder..
kindly help me out..im lost of ideas
Hi,
To read the excel file content use: POI
http://poi.apache.org/trans/es/index.html
To handle images use: java.awt.image standard library
http://www.java2s.com/Code/Java/2D-Graphics-GUI/Imagesize.htm
Regards
Ivá
Hi Guys,
I really appreciate ur ideas but im still lost.
let me explain the requirement in detail so u can suggest ne ideas...
/usr/datafile/file.xls
col1 col2 col3
data data2 imagename
adapter module sender adapter to pick the file and transform it in xml...
/usr/datafile/images/imagename
this folder has images in it...
this image size is what i ahve to find out and process file.xls only if imagename is leaa than 500 pixel...
any ideas?
Ravindra,
This is very simple...
Using module( which you already wrote) you can read Excel data. Now call for java mapping. In java mapping you can read the image file and its property directly from location "usr/datafile/images/imagename". You do not need to send this data using module.
Look at the blog provided by jose...
http://www.java2s.com/Code/Java/2D-Graphics-GUI/Imagesize.htm
String url = "http://www.java2s.com/style/logo.png"; replace with "usr/datafile/images/imagename.jpg";
For java mapping look check out this reference..... ( You can find n number of blogs on java mapping )
https://wiki.sdn.sap.com/wiki/display/Snippets/FILEtoIDOCusingJava+Mapping
Hope this will help.
Thanks,
Nilesh
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.