I stumbled across an intersting post about the state of Social sharing [update: 2017, reference lost]
Instagram and Twitter were great services once. But then along came reality and blew that house in. Instagram is now as slow as a donkey ready to become a can of cat food while Twitter is as bloated as a hippo at christmas.
What Twitter lacks is what Instagram had, the simplicity of sharing visual images. What Instagram lacks is the simplicity of communication which was the foundation of Twitter.
This is a post about Pic-stagram. A weekend project to blend the best about Instagram and Twitter.
You can view the test results of this mini project at the Pics app
The basic premise of this project is to post pics directly to Twitter without any modification only if the tweet conforms to Twitters 140 character limitation.
If the tweet exceeds that limitation the tweet is ellipsed and an alternative URL is provided by my self hosted cloud app. Commenting pics by other users is handled within the Twitter service while the “liking” of pics is a custom function via my self hosted cloud app.
As you can see, it relies on two services Twitter and my cloud app.
app (photo) -> Twitter <- comments/replies, retweets, quotes
app (metadata) -> cloud app <- likes, URL to Twitter post
Recently I have been lucky enough to assist the amazing people at one of the world’s best app companies, build a folding view controller for the iOS platform. It’s based on the excellent ECSlidingViewController and XYOrigami projects. It’s an excellent addition to this project and provides the basis of the menu system.
As for the Twitter part of the problem I’m reusing a Twitter Singleton I wrote for another weekend project.
Basically all I’m interested in is ensuring: a) I can use the iOS Twitter Framework, b) find all the Twitter accounts on the users iOS device, c) be able to grab user information for a specific account, and d) post a pic.
The TwitterSingletonDelegate provides some useful information elsewhere in the app but it’s not a requirement. The only part worth noting in this class is the postStatus method which fires our content to Twitter.
Sending a pic is done via a multipart/form POST which is surprisingly easy in iOS5.
With the transport to Twitter sorted, the next piece of the puzzle is taking a snapshot. After exploring a few options, which usually means writing stuff from scratch, I’ve settled on using Brad Larson’s GPUImage project. It’s simple to use and offers a bit of future proofing with its ability to process video as well as static photos.
GPUImage offers a heck of a lot of pre-built filters. I’ve opted to limit this project to just 5, because there really isn’t any point in spending a great deal of time playing around with filters for such a simple project. If you really want to expand your horizons with the GPUImage framework then check out Perlin Noise on GPU in GPUImage for a heads up on what’s achievable.
As you can see setting up the still camera with GPUImage is ridiculously easy but if you want to have the ability to change filters while having a live view of your subject, things get a tad complicated. Lucky for you, I’m in the rambling mood.
As you can see, it’s a bit of a mission. In my infinite wisdom I added a few additional filters to allow a bit of fine tuning of the live view before capture. In hindsight, it wasn’t the brightest idea but it was an opportunity to learn more about GPUImage. So in the header we add the following and @synthesize them in the class implementation file.
Capturing the UISlider values are done via IBAction’s
The only left to do now is capture and save the image from the camera.
If you wanted to crop the image as a square and add a picture frame, like Instagram, then all you need to do is change the captureImage method above to this:
Now that the image is captured and processed they way I like it, we jump over to constructing a message to send to Twitter.
Most people on planet earth using the Internet will be aware that Twitter has a limitation of characters based on SMS text messages. The problem with that is that Instagram doesn’t impose such a limitation. I decided very early in the design stage to allow the TweetViewController class to cater for both Twitter and people who like to ramble.
The first thing we do is instantiate our Twitter singleton class and get the current selected account’s user information. Then we grab the captured image we stored previously.
Because grabbing the image from the Assets Library can be quite time consuming we’re using blocks here.
[update 2017, I got bored written this. But as you can see at https://twitter.com/picsapp it worked well]