Options

1.2.0 images.uploadFromURL correct usage

rkallarkalla Registered Users Posts: 108 Major grins
I'm curious about the ByteCount and MD5Sum arguments needed for the uploadFromURL method.

The only way I can think (off the top of my head) of how to get those two values is to actually download the image first from the URL, count it's bytes, then do an MD5 calculation on it *then* make the call to uploadFromURL with that information.

In which case I might as well just call images.upload since I already have the image local, know it's ByteCount and MD5Sum.

I'm a little fuzzy on either (a) how to compute these values without downloading the images first or (b) the usefulness of the uploadFromURL method if I do infact have to do what I mentioned above...

Maybe I"m just being dense and missing something obvious? :dunno

Comments

  • Options
    TazzyTazzyTazzyTazzy Registered Users Posts: 32 Big grins
    edited September 28, 2007
    Nice feature but...
    This feature seems nice, but I agree. The bytes and MD5 should be optional. Maybe it is and just not noted in the API doco in the Wiki.

    -Mitch
  • Options
    rkallarkalla Registered Users Posts: 108 Major grins
    edited September 28, 2007
    Mitch,
    I double-checked, it returns error-code 5 (System Error) if you don't include the ByteCount and MD5Sum.


    Also, in addition to smugmug.images.upload not working (returning null every time), it seems that this method does exactly the same. I couldn't get any uploads to work.

    NOTE, the uploadFromURL reply looks like this:
    {
    	"stat":"ok",
    	"method":"smugmug.images.uploadFromURL",
    	"result":null
    }
    

    Which I guess it shouldn't for two reasons:
    1. It's returning a 'null' result
    2. The format of the return result is a simple 'result' argument, but all the other upload methods return an "Image" struct with an 'id' field.

    I guess we'll have to wait until David gets back.
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited October 2, 2007
    Those arguments are optional and have been marked as such in the doco. SmugMug provides such info for each of it's images without having to download the file, eg. smugmug.images.getInfo or RSS feeds using MediaRSS.

    If another service provided such information, then providing both ByteCount and MD5Sum would provide another level of fault tolerance.
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    rkallarkalla Registered Users Posts: 108 Major grins
    edited October 2, 2007
    David,
    At the top of my last reply I mentioned that not including the MD5 or ByteCount causes the op to fail with:
    {"stat":"fail","code":5,"message":"system error"}
    

    Bug then? ne_nau.gif
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited October 2, 2007
    I'm using uploadFromURL exclusively for SmuggLr without ByteCount or MD5Sum with no issues
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    rkallarkalla Registered Users Posts: 108 Major grins
    edited October 2, 2007
    I see what I did, I was using one of the SmugMug album URLS for a large sized image (didn't end with any extension) when I changed it to a *real* image URL, like the logo image from my site, it worked fine.
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited October 7, 2007
    smugmug.images.uploadFromURL has been fixed so that it correctly returns either wrong bytes/hash received instead of result:null
    David Parry
    SmugMug API Developer
    My Photos
Sign In or Register to comment.