Archive for August, 2009

Using the UIImagePickerController in an iPhone OS v2.2.1 app & On A OS v3.0 Device

Monday, August 31st, 2009

So I wrote an iPhone application for a client using v2.2.1 of the iPhone SDK. (The client did not want to go OS v3.0 yet.) I needed to give a user the capability of taking and uploading a picture with the built-in camera or uploading a picture from the photo library on the phone. Seems pretty straightforward so far. Yes? I thought so. It turned out to be pretty tricky but the solution was very simple and was staring me in the face.

The Problem
I had a UIViewController with an UIImageView setup to be used as a container for the selected image. I also had several UIButtons on the page. (One button for calling up the camera. Another button for calling up the photo library, etc…) So what should have happened is that the Camera or photo library UI would display a Modal View window the user instructing them to either take a picture or select a photo from their library. Once they did that, they would be returned to the main view and whatever photo they took or selected would appear in UIImageView as a preview. However, when I was selecting the photo the “editingInfo” NSDictionary object that was supposed to be returned would be there only about 50% of the time. The other 50% it would be returned empty. I double and triple checked my code and it was all correct. Something was zapping my dictionary object and I couldn’t, for the life of me, figure out what it was.

The second part to this problem was that the preview image never appeared whenever the user was grabbing their image from the camera. It worked if the photo library was the source but not if it was the camera. Very, very frustrating.

Here is my original code:

My .h file -

@interface AddPhotoController : UIViewController  {
IBOutlet UIImageView *imageView;
IBOutlet UIButton *snapNewPictureButton;
IBOutlet UIButton *selectFromPhotoLibraryButton;
}
@property (nonatomic, retain) UIImageView *imageView;
@property (nonatomic, retain) UIButton *snapNewPictureButton;
@property (nonatomic, retain) UIButton * selectFromPhotoLibraryButton;

My .m file -

@implementation AddPhotoController
@synthesize imageView, snapNewPictureButton, selectFromPhotoLibraryButton;
- (IBAction)getCameraPicture:(id)sender
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.allowsImageEditing = YES;
[self presentModalViewController:picker animated:YES];
[picker release];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
NSLog(@"Image Meta Info.: %@",editingInfo);

UIImage *selectedImage = image;
imageView.image = selectedImage;
self._havePictureData = YES;
[self.useThisPhotoButton setEnabled:YES];

[picker dismissModalViewControllerAnimated:YES];
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[picker dismissModalViewControllerAnimated:YES];
}

Like I said before, it all seems pretty straightforward. However, there were two things wrong with the above code.
#1. Deprecated Method
The UIImagePickerController method, – imagePickerController:didFinishPickingImage:editingInfo:, is deprecated in v3.0 of the iPhone OS. So even though I built the app using SDK v2.2.1, because the app will be running on 3.0 devices, I needed to use the new and improved method, - imagePickerController:didFinishPickingMediaWithInfo:editingInfo, which contains FIVE pieces of really important information:

  1. UIImagePickerControllerMediaType – Which specifies the type of media that this dictionary contains.
  2. UIImagePickerControllerOriginalImage – Contains the original non-cropped image.
  3. UIImagePickerControllerEditedImage – Contains the user-edited cropped image.
  4. UIImagePickerControllerCropRect – Contains the CGRect that was applied to the original image.
  5. UIImagePickerControllerMediaURL – If the object is a movie, this object contains the URL to be used by the media player.

I simply accessed the “UIImagePickerControllerEditedImage” object from the dictionary and was off to the races.

#2. Dismissing the Modal View
This one was really painful as it was so simple to solve. In order for the UIImageView to be updated correctly, you must dismiss the ImagePicker modal window BEFORE you attempt to update your UIImageView.

As a result of this, here is my updated method call:

- (void) imagePickerController:(UIImagePickerController *)thePicker didFinishPickingMediaWithInfo:(NSDictionary *)imageInfo
{
[thePicker dismissModalViewControllerAnimated:YES];
UIImage *img = [imageInfo objectForKey:@"UIImagePickerControllerEditedImage"];
previewImage.image = nil;
self.previewImage.image = img;
NSData *imageData = UIImagePNGRepresentation(img);
if ([imageData length] > 0) {
[self archivePictureData:imageData];
self._havePictureData = YES;
[self.useThisPhotoButton setEnabled:YES];
}
}

That was it. Hope that was helpful.

Ignite Advisors takes great ideas and puts them into action

Tuesday, August 25th, 2009

WebSight Design is happy to announce the brand new launch of IgniteAdvisors.net.   This site includes the administrator driven modules for news, text management, and team bio management.  We have also added a innovative new module that allows for the upload and resizing of logos to the Ignite Network.

About Ignite Advisors, LLC

In 2008, Ignite Advisors founder Eric Del Balso, realized there was a niche for Ignite Advisors, Some of the best and brightest ideas are coming out of small companies in LA and the Silicon Valley, but many of them are still struggling to make significant headway in the commercial aspects of their business. Ignite Advisors marries the brightest minds from the engineering and products disciplines with some of the best deal- makers in the industry.

Ignite Advisors has assembled a highly seasoned advisory panel across all disciplines with both years of expertise and vast networks. This deep bench of talent brings a short, impactful burst during those critical early stages of fledgling digital media companies. Ignite Advisors’ strategic services help these companies make the alliances and partnerships that will help them realize their full potential quickly.

Visit PremierConcerts.com for concert tickets in Connecticut and Massachusetts

Monday, August 24th, 2009

Premierconcerts.com has just relaunched their site will a new design and new features from WebSight Design.

Premierconcerts.com for concerts in Connecticut and Massachusetts

The new design includes a rotating banner feature on the newly redesigned homepage.  This banner cycles through images that are uploaded from the administrator and highlight featured upcoming shows.  With this relaunch they have added a fabulous new photo gallery where you can browse through galleries of past show that they have represented. They have also added an archive feature to their site.  In the archive you can review all their past shows including information about headliners and supporting acts.

Premier Concerts produces and promotes concerts for amazing artists such as, Van Morisson, Alice Cooper, and Tony Bennett.   Premierconcerts.com is a one stop shop in where you can find all the information you will need about concert venues, show information and concert tickets in Connecticut and Massachusetts.

Premier Concerts was formed in January 2004 by veteran entertainment executive producer Peter Kauff and investor and concert promoter Keith Mahler.  Through the restoration of the Palace Theater in Waterbury, CT, they launched Premier Concerts to produce and promote concerts in Connecticut and Massachusetts.  Peter and Keith have been working in concert promotion and production for over 20 years and have represented some very popular artists including, George Carlin, REO Speedwagon, The Eagles, Led Zeppelin, The Who, and Jethro Tull.

WebSight Design SEO Success Story – Storage Seeker

Thursday, August 6th, 2009

WebSight Design understands how important search engine optimization (SEO) is to your site. Having bad SEO is like opening your shop in the middle of the desert, and forbidding people from having your phone number and address.  Not much business is going to happen that way!  But buyer beware, there are many different SEO scams out there, some of which could even get your site banned from Google.  When it comes to SEO, you want experts who have years of industry experience and understand best practices.

Recently one of our SEO experts, Alan Bleiweiss, published a case study for StorageSeeker.com on Search Engine Journal, one of the premier SEO blogs online.  In it he shares the methodology he used to get our client to the top of the first page of Google.  Alan and the SEO team at WebSight Design are masters at best-practice SEO techniques and achieving awesome organic search results.

Read the article: Sitemaps and Internal Links – 10000 Page Test

WebSight Design in the News

Thursday, August 6th, 2009

Our very own Chief Technology Officer, Lawrence Leach, was on a panel for the 2nd Annual “Songwriter’s Bootcamp” In LA, hosted by SESAC and co-sponsored by Billboard Magazine.  This free symposium is for artists and songwriters to be educated and updated on all aspects of the music business with panel lectures and discussions courtesy of an array of established writers, producers, lawyers and industry insiders.

Billboard Magazine August 2009

Billboard Magazine August 2009

Download the PDF article here

WebSight Design and 11345.com

Tuesday, August 4th, 2009

WebSight Design is proud to announce that we have been selected by 11345.com to redesign and re-engineer their web site. We’re excited to give this project our all!

11345 is Not only do they carry hundreds of items pop, rawk n’ roll, cow-punk, alt-country, and garage items, as well as t-shirts, stickers, and zines from independent artists and labels,  11345 is also the exclusive mail-order provider for many webstores.

The 11345 record label represents artists such as Tucker, Sandycoates, Goodfellas, Cables, Nova Come Home, and Overlap.

We might post a sneak-preview of the interface later on, but rest assured that the new 11345.com will look cool and function with smooth efficiency.