This project has moved and is read-only. For the latest updates, please go here.

A few photos no longer downloading properly

Topics: Developer Forum
May 17, 2009 at 12:02 AM
Edited May 17, 2009 at 12:34 AM

I download a given photo file with this code:

    WebClient webClient = new WebClient();
    webClient.DownloadFile(usePhotoSize.Source, photoSavePathUnfinished);

A couple days ago, this worked fine for all the photos I was downloading.  Today, at least two of these same files are downloading as 0x0 jpg files, but the others are fine.  I can get at the image just fine if I put the value of usePhotoSize.Source in my browser (actually it displays in the browser, but save image as results in a 0x0 image file as well).  I know this isn't a Flickr.NET problem, but might anyone know what could be going on?

I tried calling Flickr.FlushCach(), clearing my browser's cache with no effect (none was expected).  Very strange...

Getting stranger.  If I run this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;

namespace ConsoleApplication1
    class Program
        static void Main(string[] args)
            WebClient webClient = new WebClient();
            webClient.DownloadFile(@"", @"C:\test1.jpg");
            webClient.DownloadFile(@"", @"C:\test2.jpg");

Test1.jpg shows in Explorer as 220KB 0x0 file.  Test2.jpg shows as 397KB 2048x1365 file.  If I open Test1.jpg in Paint Shop Pro, it opens fine, and when I resave it, it shows as a 1027KB 2048x514 file.  I now remember seeing this happen before when downloading images from the web.  Does anyone else ever experience this?

May 18, 2009 at 1:58 PM

I've tried the above code myself and Paint.Net failed to open the first file. At first I thought it might have been because the 'original' wasn't a JPEG - but the file appears to be a JPEG and the file header looks ok from that point of view. I also tried downloading the file via Firefox, and also directly from Paint.Net and got exactly the same error.

Not sure I can be of much more help I'm afraid.

May 18, 2009 at 9:13 PM

Thanks!  At least it is consistent across machines, it seems.  It's just something that happens, rarely, when downloading images from the internet.  I've never had the opportunity to see an image consistently work fine one day, then consistently have this problem the next.  At least PSP allows me to "fix" these images, as does Photoshop.  And a friend says the Linux viewer can open it.