Problem writing metadata to jpg

Hi,

I have a small form app that imports a image that a user browses to and adds the metadata to that image based on information provided in the form.

The process does work, it just doesn't write the description properties. It writes to the copywrite tag just fine, as well as create and transport the new image between servers.

Any help is always appreciated.  The code that is supposed to write the metadata is:

if(this.sErrors == "") {
                try {
                    ASCIIEncoding oEncoder = new ASCIIEncoding();
                    string sNewFile = Guid.NewGuid().ToString("D")+".jpg";
                    string sFile = Server.MapPath("tmp\\upload-"+sNewFile);
                    PropertyItem oProp;
                    PictureLocation.SaveAs(sFile);
                   
                    Image imgUpload = Image.FromFile(sFile);
                    foreach(PropertyItem oProperty in imgUpload.PropertyItems) {
                        imgUpload.RemovePropertyItem(oProperty.Id);
                    }
                   
                    oProp = CreatePropertyItem(0x0320, PictureCaption.Text);
                    imgUpload.SetPropertyItem(oProp);
                   
                    oProp = CreatePropertyItem(0x013B, FirstName.Text+" "+LastName.Text+" ("+EMail.Text+")");
                    imgUpload.SetPropertyItem(oProp);

                    // works: Also tested writing other properties to this string, and other inputs work                   
                    oProp = CreatePropertyItem(0x8298, Address.Text + ", " + City.Text + ", " + State.Text + " " + ZipCode.Text);
                    imgUpload.SetPropertyItem(oProp);
                   
                    oProp = CreatePropertyItem(0x010E, WhatKindOfFun.Value);
                    imgUpload.SetPropertyItem(oProp);
   
                    imgUpload.Save(Server.MapPath("tmp\\process-"+sNewFile));
                    imgUpload.Dispose();
                   
                    // Create directories.
                    DateTime oDate = DateTime.Now;

                    this.CreateFTPDirectory("ftp://64.179.77.44/"+Convert.ToString(oDate.Year)+"/");
                    this.CreateFTPDirectory("ftp://64.179.77.44/"+Convert.ToString(oDate.Year)+"/"+Convert.ToString(oDate.Month)+"/");
                    this.CreateFTPDirectory("ftp://64.179.77.44/"+Convert.ToString(oDate.Year)+"/"+Convert.ToString(oDate.Month)+"/"+Convert.ToString(oDate.Day)+"/");
                   
                    // FTP file to Interchange.
                    FtpWebRequest oFTP = (FtpWebRequest)FtpWebRequest.Create("ftp://64.179.77.44/"+Convert.ToString(oDate.Year)+"/"+Convert.ToString(oDate.Month)+"/"+Convert.ToString(oDate.Day)+"/"+sNewFile);
                    oFTP.Method = WebRequestMethods.Ftp.UploadFile;
                    oFTP.Credentials = this.oCred;
                    oFTP.UsePassive = true;
                    oFTP.UseBinary = true;
                    oFTP.KeepAlive = false;
                   
                    FileStream oFile = File.OpenRead(Server.MapPath("tmp\\process-"+sNewFile));
                    byte[] oBuffer = new byte[oFile.Length];
                    oFile.Read(oBuffer, 0, oBuffer.Length);
                    oFile.Close();
                   
                    Stream oStream = oFTP.GetRequestStream();
                    oStream.Write(oBuffer, 0, oBuffer.Length);
                    oStream.Close();
                   
                //    File.Delete(Server.MapPath("tmp\\upload-"+sNewFile));
                //    File.Delete(Server.MapPath("tmp\\process-"+sNewFile));
                   
                    Response.Redirect("The site it goes to");
                } catch {
                }
            }

0
Kosko
4/27/2009 1:17:13 PM
asp.net.futures 1064 articles. 0 followers. Follow

0 Replies
548 Views

Similar Articles

[PageSpeed] 19

Reply:

Similar Artilces:

Problem with .net elements in vb.net Response.Write
I need to do a response.write on an aspx page in vb.net , where as the response.write will display on "if" condition. I'm trying to display an Iframe that contains another file, with querystring parameters. Even when I double up/escape the quotation marks, still get a "String constants must end with a double quote" error on this line: <%= response.write("<IFRAME src=banners/nv-A1List.aspx?zone=<%=request.querystring(""zone"")%> name=banner width=234 height=60 frameborder=no border=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=no>...

Problems, problems, problems
Name: Hans Halvorsen Email: capricorn_at_online.no Product: Thunderbird Summary: Problems, problems, problems Comments: Hi, I downloaded Thunderbird some time ago, and I was over-satisfied whit it and how well it worked. In fact it worked 100% PERFECTLY UNTIL I got an newer update version of it. Since then I' ve had nothing BUT trouble! I've checked adresses, notes, password, deleted accounts and made new one's, checked sign-ins and sign-outs, passwords inside and out, upside and down, so many times that my frustration now is about to turn into pure and major ...

Problems with Futures (May) install and .NET Hotfix
I am installing the May release on an XP machine that has .NET 2.0 and 3.0 installed. It comes up and says it needs to install the .NET Framework 2.0 Hot Fix (KB925675). I click OK and then it comes up with this error: "This patch package could not be opened. Verify that the patch package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer patch package." Don't know how to get around this. I tried to look for the hot fix on MSDN and Windows Update, but could not find it. Anyone have any solutions?  ...

Problems Problems Problems
So, I have OpenSUSE installed on my laptop and everything is working well, except the wireless. It almost seems that every time I run a KDE distro I can not get the internet to work. I've run YaST and used iwconfig. nothing is working for me. Please help -ZAD -- zadnik18 ------------------------------------------------------------------------ someone is going to tell you to supply some more information 'My wireless doesn't work - a primer on what I should do next - openSUSE Forums' (http://tinyurl.com/6peanc) this is one of the stick...

Problems, problems, problems
Name: Product: Firefox Summary: Problems, problems, problems Comments: I use FF all the time for work - I'm a software tester - the add-ons are invaluable. But v3.5 really has been a disappointment. It just keeps hanging all the time. And when Internet Explorer windows pop up, FF often just dies. It can't even restart itself - I have to manually kill the process every time; every update, every add-on that updates, "restart" fails - it's so frustrating. I hope v3.6 will be addressing this - PLEASE! Browser Details: Mozilla/4.0 (compatible; MSIE 7....

PROBLEMS, PROBLEMS, PROBLEMS.
Name: Product: Firefox Summary: PROBLEMS, PROBLEMS, PROBLEMS. Comments: Does Google's Chrome browser block out Firefox? Am having a lot of trouble getting Firefox to run after I run Chrome. No trouble what-so- ever before running Chrome. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1064 Safari/532.5 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see ...

Problems problems and problems.
Name: A.A. Product: Firefox Summary: Problems problems and problems. Comments: I am not specific, but in short I can not use This site to listen music anymore, while I can in IE explorer. Just to let you guys know, new version messed something up. http://hypem.com/ Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

How can I write image metadata using VB.NET?
I am developing an ASP.NET 3.5 website for a photographic competition and I want to write some entrant identification and image title information into either the XMP or IPTC metadata of each uploaded digital image. We will be accepting both JPEG and TIFF images. However, I've no idea how to do this. I've tried searching for guidance on the writing of image metadata but without any success so far. I would be grateful if anyone could point me towards some useful sources of guidance on this topic and/or some VB.NET code samples. David...

Problems writing to an XML file
I'm brand new to using XML (in fact this is my first project), so bear with me, I may need a little hand-holding. I'm trying to create a page which simply adds data to an existing xml file. Ultimately it will add the data from a form, but to keep things simple, I've been simply using pre-defined values. Originally I was able to get the script to write the xml exactly as I needed, however it would simply overwrite the existing file every time it was accessed. This is unacceptable, as it will be used to add data to one file, sort of like a mini database. So after much pain and gnashi...

Code generation in Microsoft.net ( code that writes code ) Whats its future
Hello, I was just reading a book about Code Generation in .NET. Its damn hard book to read. What do u think is the future of Code GenerationHighOnCodingWanna get high! It's being used now quite a bit. Not necessarily out the box click a button, and you get an application, but applications will generate specific code to function dynamically.Kay LeeMySpace.com - http://www.myspace.com/kragieInfrastructure GroupMySpace.com- Code to live, but Live to code. the refactoring tools already available (and those that are destined for the new IDE) use the same techniques. we will pr...

The future of .Net development and Dw.Net
I have created a few Intranet apps using Datawindow.Net/Asp.Net. It was an "okay" experience. I have to say that the UI is much better due to the Datawindow. I have considered The Telerik or Dev Express controls but these two are built upon the Gridview and it is truly a very outdated object. Actually, the whole web application model just is not robust for true internal business apps. I guess the "honeymoon" is over for me when considering web application development. And, I am surprised if I hear about any company developing an Intranet approach for internal...

Problems while porting .Net framework 1.0 (VB.Net) application to .Net Framework 1.1
Hello,   I have a ASP.Net web application,written in VB.Net,developed on .Net Framework 1.0 .I am trying to port it on to .Net framework 1.1.   For achieving this,I follow the following steps-   1.Open the project using the .vbproj file. 2.I am prompted with the conversion message "Do you want to convert the solution and all projects to .Net framework  1.1....." 3.I click "Yes" 4.I assume that the project is now converted. 5.I build the project & try to run it. 6.I get the following error -     Server Error in '/Consert.Net' Application. ...

Problem writing Facebook apps in .NET -Request for the permission of type 'System.Web.AspNetHostingPermission failed
Hi folks, I have been trying to follow the instructions found here: http://devtacular.com/articles/bkonrad/how-to-use-the-facebook-developer-toolkit-20/ To get a Facebook application going in ASP.NET.  I had previously installed the Facebook Developer Toolkit and used the Facebook Starter Kit template, but I kept running into an error so I went with the simpler instructions found in the link above.  Unfortunately, I still get the same error, and as far as I can tell the error first starts showing up when I set my Default class to inherit facebook.web.CanvasFBMLBasePage.&n...

Printing problem - Vista
I have a strange issue with a Visual Studio .net 2008 distributable application.   The printing does not work on my Clients computers who have Vista OS.  All of my clients get the following error when they try to print any form from my application.   The PrintDialog displays and the Client clicks on Ok.  The PrintDialog logic generates the the programmed exception "An Error occurred printing the report".  The system generates the following error "Attempting to read or write protected memory.  This is often an indication th...

Web resources about - Problem writing metadata to jpg - asp.net.futures

Metadata - Wikipedia, the free encyclopedia
Metadata is " data about data". The term is ambiguous, as it is used for two fundamentally different concepts ( types ). Structural metadata ...

Metadata, Content Security: Metadatarisk.org
Metadatarisk.org is a public-benefit site offering information on content security. If you have an article or relevant website that you would ...

Metadata Working Group (MWG)
The MWG publishes technical specifications that describe how to effectively storemetadata into digital media files. These royalty-free specifications ...

Why Metadata Matters: The NSA and the Future of Privacy
Over at Slate, Dahlia Lithwick and Steve Vladeck have a great piece about why "metadata" matters. It is very much worth reading. Here are some ...

TrashExif - Metadata of photo remover with presetting on the App Store on iTunes
Get TrashExif - Metadata of photo remover with presetting on the App Store. See screenshots and ratings, and read customer reviews.

All sizes - Hillmann's Real Metadata. - Flickr - Photo Sharing!
Flickr is almost certainly the best online photo management and sharing application in the world. Show off your favorite photos and videos to ...

dekePod Episode 001: Metadata Forensics, What a Crock - YouTube
We all know digital photos can be modified. So much so that, at least in the popular lexicon, Photoshop is synonymous with turning fact into ...

MP urges Bill Shorten to consult more with caucus as Labor agrees to back the Coalition's metadata retention ...
Bill Shorten has been sent a warning shot to fix the way he operates and consult his colleagues more during an extended debate on metadata in ...

Malcolm Turnbull's Sky News interview basically renders the metadata retention laws useless
Mal comms in the middle. After several months of the Abbott Government telling Australians how important the metadata laws are to catch paedophiles ...

Access to metadata is vital for crime fighting: says internet safety advocate
OPINION: Alastair MacGibbon argues access to metadata is vital for criminal investigations, provided proper oversight is in place.

Resources last updated: 12/15/2015 9:08:21 AM