Bummer! You must be logged in to access this page.

Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

thumbnail image

i dont know how to place the videos i get from parse.com to a thumbnail image in the cell's in my tableViewController please help

3 Answers

you will need to save a thumbnail for the captured video to parse which can be accomplished using a moviePlayerController method. so when the user uses the imagePicker to capture video, you will create a thumbnail in your didFinishPickingMediaWithInfo delegate method. then save that thumbnailImage to parse when you save the video data as well. Then you can just download the thumbnail image in the background in your cellForRowAtIndexPath and display it in your tableViewCell just like any other image.

//create the thumbnail for the video
            //you will have to add a moviePlayerController property to your viewController. 
            self.moviePlayer.contentURL = [info objectForKey:UIImagePickerControllerMediaURL];
            UIImage *thumbnail = [self.moviePlayer thumbnailImageAtTime:1 timeOption:MPMovieTimeOptionNearestKeyFrame];
            //you also need a property to store the thumbnail image
            self.thumbnailImage = [self resizeImage:thumbnail toWidth:75.0 andHeight:75.0];

here is the resize method:

- (UIImage *)resizeImage:(UIImage *)image toWidth:(float)width andHeight:(float)height {

    CGSize newSize = CGSizeMake(width, height);

    CGRect newRect = CGRectMake(0, 0, width, height);

    UIGraphicsBeginImageContext(newSize);
    [image drawInRect:newRect];
    UIImage *resizedImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return resizedImage;

}

ok thank you soooooo much i was stuck with this for so long, one more thing do i have an object that parallels with the thumbnail image saved off the video that was uploaded and saved, and what do i do if i have videos i manually place in parse how do i get the thumbnail for them

is there a progam that i can download that i can create a thumbnail image of the videos if so please help