OldBooth and Facebook problem

About two weeks ago we’ve received a couple of emails from our users. Those emails had an interesting content. People were saying that, photos from OldBooth couldn’t be uploaded to Facebook using official Facebook.app for iPhone.

At the beginning I was thinking, that’s not my problem, why should I care. I know that OldBooth is creating images properly and that on iPhone I don’t really have any control over the image, if I want it to be stored in Camera Roll. That’s how I felt the first day, when the problem occurred, but after 2 days I thought: “Hey, wait a minute, that is a problem and it’s my problem”. I understood that I can’t say Facebook should fix it, because If my users can’t upload photo from OldBooth they don’t have bad experience with Facebook, they have bad experience with OldBooth. I decided, that I will spend one day trying to fix it, but to be honest, I didn’t know how to fix an error that is caused by other application.

If I have a bug in my own code I can run debugger, I can watch how app is running catch those exceptions that are causing problems, if I don’t have source code, I’m obviously screwed. I had to do it different way.

I started by running Facebook.app and I tried to upload photo from OldBooth, it didn’t work but I knew that. OK, maybe there is a problem with the way images are generated, some kind of wired conditions, who knows, I didn’t have enough informations. I made second test, I uploaded normal photo from Facebook.app (that was a photo of my armchair, which was taken from within Facebook.app), interesting thing was that it worked. Really wired stuff I thought. My third attempt was uploading screen capture from my iPhone and it didn’t work either.

If screen capture couldn’t be uploaded I was sure, that it’s not a problem with OldBooth code. Photo uploaded without any problems, but images from iPhone were not, what is the difference between those two types of images? Size, size made all the difference so I started checking if changing size of OldBooth image would fix it. At the beginning I started with huge, huge image over 1024 width, and It uploaded without any problems. Ok it’s interesting, but Facebook.app doesn’t allow me to upload too small images. If I know that I can fix it by simply upscaling images before saving, but I must find minimal size of photo, that will be uploaded. It took me about an hour to find out, that images which weight was smaller than 595 pixels were not working. I don’t know why 595 is the magic number, but that was the number. Normal OldBooth picture has 320 pixels width, and the minimal number that I could use to upscale was 608 pixels (320 pixels * 1.9). Here is a code that is doing the trick:

CGImageRef imageRef = [imageToSave CGImage];
CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef);

alphaInfo = kCGImageAlphaNoneSkipLast;
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef bitmap = CGBitmapContextCreate(NULL, 
                                             608, 
                                             874,
                                               8, 
                                       4 * (608),
                                      colorSpace,
                                       alphaInfo);

CGContextDrawImage(bitmap, CGRectMake(0, 0, 608, 874), imageRef);
CGImageRef ref = CGBitmapContextCreateImage(bitmap);
UIImage *result = [UIImage imageWithCGImage:ref];

CGContextRelease(bitmap);
CGImageRelease(ref);
CGColorSpaceRelease(colorSpace);

I don’t know why did Facebook decide to block smaller images, I don’t even know if that is a bug in their app or some kind of conscious choice their made, but two things I know for sure. Upscaling images made it possible to upload photos to Facebook and users have better experience with OldBooth now, even if they don’t even know that. Second thing is that relaying on external applications is not a good idea, because I don’t have control over them. That upscaling is a hack, not permanent solutions. It’s good, but images are larger now, they cost more time and money to post and are blurred, because that’s what upscaling does. Next thing that I have to do is add Facebook integration to OldBooth, this way I should be able to send to Facebook whatever I want and if I want to add Facebook, why not Twitter or other services? It’s simple, OldBooth will have to be more social now and that is next step for it.

If you have any other problems with OldBooth, email us, or email me directly at arek@getapp.net.

OldBooth Premium

version 3.2.2

  • Workaround added for Facebook.app bug that wouldn’t allow to upload OldBooth photos.