From: Peter Olcott on 16 Mar 2010 10:55 I want to sent a 24-bit PNG file to a web service that I will be writing. In the ideal case the user will go to my website and click on a button that will browse their local hard-drive for a PNG file. This file is then verified to be 24-bit on the client side. If it is 24-bit it is then sent to the web-service. If it is not 24-bit an error message is displayed "The PNG file selected must have 24-bit color". Can this be done in either JavaScript or Java?
From: Ivan Marsh on 16 Mar 2010 11:07 Peter Olcott wrote: > I want to sent a 24-bit PNG file to a web service that I > will be writing. In the ideal case the user will go to my > website and click on a button that will browse their local > hard-drive for a PNG file. This file is then verified to be > 24-bit on the client side. If it is 24-bit it is then sent > to the web-service. If it is not 24-bit an error message is > displayed "The PNG file selected must have 24-bit color". > > Can this be done in either JavaScript or Java? It can be done in HTML. http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_FILE.html -- "All right, all right, if it will make you happy, I will overthrow society." - Philip J. Fry
From: Knute Johnson on 16 Mar 2010 12:16 On 3/16/2010 7:55 AM, Peter Olcott wrote: > I want to sent a 24-bit PNG file to a web service that I > will be writing. In the ideal case the user will go to my > website and click on a button that will browse their local > hard-drive for a PNG file. This file is then verified to be > 24-bit on the client side. If it is 24-bit it is then sent > to the web-service. If it is not 24-bit an error message is > displayed "The PNG file selected must have 24-bit color". > > Can this be done in either JavaScript or Java? I'm not an expert on PNG files, but I'm sure it is possible to read a PNG file and determine that it is 24 bit with Java. Sending it to your website is no problem. The issues come with how. Java Applets need to be signed to get at the local file system. HTML can send a file as Ivan suggested but the browser won't be able to determine whether or not it is a 24 bit file. So my suggestion would be to use HTML to send the file and write a perl or php CGI program to run on your web server to read the file. If it is 24 bit accept it if not discard it and display a message to the user that it wasn't a 24 bit file. -- Knute Johnson email s/nospam/knute2010/
From: Roedy Green on 17 Mar 2010 02:10 On Tue, 16 Mar 2010 09:55:21 -0500, "Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote, quoted or indirectly quoted someone who said : >I want to sent a 24-bit PNG file to a web service that I >will be writing. In the ideal case the user will go to my >website and click on a button that will browse their local >hard-drive for a PNG file. This file is then verified to be >24-bit on the client side. If it is 24-bit it is then sent >to the web-service. If it is not 24-bit an error message is >displayed "The PNG file selected must have 24-bit color". Here are two approaches in Java. 1. low level. Read up on the format of PNG files. Use DataInputStream to read the fields and check that the file is of the flavour you want. see http://mindprod.com/jgloss/png.html 2. load the file in any Java-supported format as an Image and then save it in the format you want. See http://mindprod.com/jgloss/pngencoder.html I could write you a class to do it either way for $50. -- Roedy Green Canadian Mind Products http://mindprod.com Responsible Development is the style of development I aspire to now. It can be summarized by answering the question, �How would I develop if it were my money?� I�m amazed how many theoretical arguments evaporate when faced with this question. ~ Kent Beck (born: 1961 age: 49) , evangelist for extreme programming.
From: Peter Olcott on 17 Mar 2010 13:25 "Roedy Green" <see_website(a)mindprod.com.invalid> wrote in message news:has0q51itgbd9t3mset6tg0pfcgs8vame4(a)4ax.com... > On Tue, 16 Mar 2010 09:55:21 -0500, "Peter Olcott" > <NoSpam(a)OCR4Screen.com> wrote, quoted or indirectly quoted > someone who > said : > >>I want to sent a 24-bit PNG file to a web service that I >>will be writing. In the ideal case the user will go to my >>website and click on a button that will browse their local >>hard-drive for a PNG file. This file is then verified to >>be >>24-bit on the client side. If it is 24-bit it is then sent >>to the web-service. If it is not 24-bit an error message >>is >>displayed "The PNG file selected must have 24-bit color". > > Here are two approaches in Java. > > 1. low level. Read up on the format of PNG files. > Use DataInputStream to read the fields and check that the > file is of > the flavour you want. see > http://mindprod.com/jgloss/png.html > > 2. load the file in any Java-supported format as an Image > and then > save it in the format you want. > See http://mindprod.com/jgloss/pngencoder.html > > I could write you a class to do it either way for $50. > -- Would it run on the client side and work across most every browser? Could it be invoked from a BrowseForFile Button on my web-page that filters for PNG files? One more thing, I need it to send the file over HTTP. > Roedy Green Canadian Mind Products > http://mindprod.com > > Responsible Development is the style of development I > aspire to now. It can be summarized by answering the > question, "How would I develop if it were my money?" I'm > amazed how many theoretical arguments evaporate when faced > with this question. > ~ Kent Beck (born: 1961 age: 49) , evangelist for extreme > programming.
|
Next
|
Last
Pages: 1 2 3 Prev: Socket Buffered*putStream Threads and Full-duplex communication Next: JLabel.setText |