|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
get binary file data into an integer array
hai everybody,
For manipulating an image, I need to get the image data into an integer array initially. I was not able to convert the "variable" data into integer type, which("variable") is automatically produced after execution of the tag <cffile action = "readbinary" variable = "output" file = "c:\images\nikon.jpg"> I think All the data is being lost, after converting to "base64" or "string" type. So, anyone please give me some code to get the image data into an integer array. Thanking you in advance, kishore |
|
#2
|
|||
|
|||
|
This is going to be the same issue as your other question. CFFILE is not meant to read in binary data byte by byte, nor is it meant to create arrays of bytes. The easiest way to do this is with Java (or wiritng a C++ custom tag but that is more work in my opinion).
Calling Java classes inside CFML is very easy, you use createObject() to create an instance of a Java class, and then you can call methods on it just like you would on a CFC instance. This applies to classes you write as well as the existing Java API classes. The docs have some info: http://livedocs.macromedia.com/cold...mldocs/java.htm But Googling it may give some more detailed or applicable examples: http://cephas.net/blog/2003/06/28/c...coldfusion.html
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
According to the CF documentation, it shoudl work. Here's a clip from the CFMX 6.1 docs:
Reads a binary file (such as an executable or image file) on the server, into a binary object parameter that you can use in the page. To send it through a web protocol (such as HTTP or SMTP) or store it in a database, first convert it to Base64 using the ToBase64 function. Note: This action reads the file into a variable in the local Variables scope. It is not intended for use with large files, such as logs, because they can bring down the server. ** Notice that the docs say "To send it through a web protocol (such as HTTP or SMTP) or store it in a database, first convert it to Base64 using the ToBase64 function." |
|
#4
|
|||
|
|||
|
hai kiteless,
You are really doing a great job.First i should thank you, for your keen interest in answering to members questions. Ya ! What you said is right. I will try to build my application using java API classes. I am already having the complete code for my application in c++, but i cannot create a cfx tag because of some installation problems with coldfusion,as i pointed earlier in my other query. Any way, thanks a lot for your help. I will read the docs for java. thank you, bye kishore. |
|
#5
|
|||
|
|||
|
hai glively,
ya ! I have read the cf docs about reading binary image data.They pointed to convert the binary data into into base64(we use ToBase64(string)). I think, it is a very complex and error-prone task in cfml because images(jpeg,tiff,,etc) contain many complex characters(many special characters), which will be lost after converting to base64(i have done it). The only way, as far as i know, is to directly read the image character by character into integer type, and try manipulating them. Any way, as Mr.Kiteless has pointed out, i will try using java classes. Thank you, bye kishore. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > get binary file data into an integer array |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|