I am able to upload one picture but I can't create a photoset with multiple images using API.
Documentation says: Paramater: Array (URL-encoded binary contents)
One or more image files (submit multiple times to create a slide show)
Does anyone know how to do it?
You can choose up to 10 images, then drag to rearrange them. If you've already added photos, you can add more by clicking the camera icon below them that says "Add another."
Just grab a photo and place it where you'd like. Hover over an image to add a caption. Add a note for your followers and tags so your amazing photos can be discovered by other users. And preview, save, or publish your amazing work!
It's kind of a painful process, but I figured it out after studying the python code Tumblr posted. In short, it requires getting the hexadecimal for the photo and then doing some substitutions.
I've created a simple iOS / iPad / iPhone project on GitHub that uploads multiple photos to photosets using the Tumblr API, based heavily on the ASIHTTPRequest+OAuth project. It works so far in my limited testing -- feel free to make use of it and let me know how it goes.
The new PhotoUpLink for iPhone uploads true Tumblr photosets. It is a free download from the App Store at http://uplink.to/5o example photosets at http://photouplink.tumblr.com
The Tumblr uploader is based on @VictorVanHee's epic. I did optimize the code by switching to straight C for the NSData stringWithoutURLEncoding subroutine:
- (NSString *) stringWithoutURLEncoding
{
NSString *hexDataDesc = [self description];
hexDataDesc = [[hexDataDesc stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]] stringByReplacingOccurrencesOfString:@" " withString:@""];
int hlen = [hexDataDesc length];
NSString *hexDataDescU = [hexDataDesc uppercaseString];
const char *hexcString = [hexDataDescU cStringUsingEncoding:NSASCIIStringEncoding];
char *newStringC = malloc(hlen *3);
memset(newStringC, 0, hlen *3);
int xC= 0, upd = 3000, value = 0;
char *componentC = malloc(5); // = "XX";
componentC[2] = 0;
const char *px = "%x"; char ptc = '%';
for (int x=0; x<hlen; x+=2)
{
componentC[0] = hexcString[x];
componentC[1] = hexcString[x+1];
value = 0;
sscanf(componentC, px, &value);
if ((value <=46 && value >= 45) || (value <=57 && value >= 48) || (value <=90 && value >= 65) || (value == 95) || (value <=122 && value >= 97)) //48-57, 65-90, 97-122
{
newStringC[xC++] = (char)value;
}
else
{
newStringC[xC++] = ptc;
newStringC[xC++] = (char)componentC[0];
newStringC[xC++] = (char)componentC[1];
}
}
NSString *newString = [NSString stringWithCString:newStringC encoding:NSASCIIStringEncoding];
NSString *aNewString = [newString stringByReplacingOccurrencesOfString:@"%20" withString:@"+"];
free (newStringC);
free (componentC);
return aNewString;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With