FOTON Foton: The easy way to share photos Nachiket Deo Ashutosh Pande Narasimhan Srinivasan 1 FOTON Table of Contents 1. Motivation 2. Design Considerations 2.1 Web based versus Desktop application 2.2 User of APIs versus automated logins 3. Contributions of our project 4. Foton Architecture 5. Prototype Implementation 5.1 Snapshot 5.2 Technology 5.3 Challenges 5.3.1 Authentication 5.3.2 Uploading pictures to albums 5.4 6. Comparison between Flickr and Picasa Suggested API Framework for image/video distribution 6.1 API signatures for image distribution 6.2 API framework for video distribution 7. Future Work 8. References 2 FOTON 1. Motivation The class lectures on Web 2.0 was the starting point of our application. The concept of Web 2.0 to bring people together using internet based applications which act as distributors of information greatly appealed to us. Hence we wanted to contribute to the web 2.0 movement in our own way through our class project. Online photo albums and photo sharing services have become increasingly popular nowadays. Each photo sharing website requires the user to create a separate login and password associated only with that site. A user typically is a member of multiple sites such as Facebook, Picasa, Flickr, Snapfish etc. However when it comes to sharing content such as photos, she is faced with the tiresome task of uploading her photos separately to each website. This task is fully redundant and hence largely disliked by the user. It also limits content sharing and the visibility of uploaded content thus going against the sharing ethos Web 2.0. Solving this problem of multiple redundant uploads was the main motivation of developing Foton. We wanted to develop an application which would allow the user to upload her photographs directly from her computer to multiple sites of her choice without requiring her to login to each site individually and upload separately. 2. Design considerations Two considerations central to our application design were 2.1 Web based versus Desktop application We decided against making our application web-based because of the following reasons: 1) Our main aim was NOT to provide another photo sharing site. Instead it was to give the user a platform using which she could seamlessly connect to existing sites and upload her photos. 2) A web application would cause us to incur cost of storage for storing the images and maintaining a website. This would be both unnecessary and prohibitive considering the high amount of image content which can potentially pass through our application. 3 FOTON 2.2 User of APIs versus automated logins For our prototype implementation, we decided to target sites with well defined APIs. We did so because of the technical and in particular, security issues associated with automated logins. 3. Contribution of our project • User can upload to Flickr and Picasa by a simple click. • API Framework for uploading images • API Framework for uploading videos 4. Foton Architecture Foton enables users to upload pictures simultaneously to two different photo hosting sites. Shown below is the high level architecture of the Foton application. USER authentication data FOTON ERROR NO authentication valid? YES NO input picture? YES UPLOAD 4 picture Browser File System FOTON 5. Prototype Implementation Through Foton we have enabled the user to upload pictures to Picasa and Flickr simultaneously for now. We detail below the steps involved in doing the same. Picasa 1. Authenticate: Send username and password obtained from user 2. Find a feed URL - http://picasaweb.google.com/data/feed/api/user/userID?kind=kinds 3. If the album does not exist create a new album 4. Construct appropriate URL, use client library methods to create new album objects and use PicasawebService to send the request along with user credentials 5. If the album already exists upload photo to that album 6. Post the new photo (formats bmp, jpg, gif, and png are supported) Flickr 1. To be done by user: User obtains APIKey and SharedSecret -> APIKey and SharedSecret required to obtain Authentication token (User must sign in to Yahoo!) -> MD5(APIKey + SharedSecret + Authentication Token) used to sign POST requests that contain image data 2. Create POST request (Appendix A) 3. Sign the request with MD5 hash of ApiKey+SharedSecret+AuthToken 4. Covert image file to an array of bytes and include it in the POST 5. Send the POST to URL http://api.flickr.com/services/upload/ 6. Receive photo id 5 FOTON 5.1 6 Snapshot FOTON 5.2 Technology We use Java to compose and send HTTP POST requests to Picasa and Flickr. The GUI was done using Java Swing package. 5.3 Challenges 5.3.1 Authentication We observe that there is a significant difference in the authentication method for Flickr and Picasa. Picasa’s method is much more robust and elegant. Our application passes on the username and password directly to Picasa as opposed to api_key and shared_secret required by Flickr. 5.3.2 Uploading pictures to albums Both Picasa and Flickr allow POST requests containing image data. Picasa also enables our application to work with albums without any hassles. In contrast, Flickr’s approach is not very straightforward. In Picasa we can directly POST the image to the URL that contains album name 7 FOTON (optional) as well. If album is not found the picture is automatically stored in default album. Whereas Flickr forces us to POST all images to one static URL. 5.4 Comparison between Flickr and Picasa Parameter Picasa Authentication • Simple but secure procedure • Picasa allows login information to be sent from desktop Flickr • involvement • applications • This is very convenient for all • • Picasa allows better • • Foton and Foton should take over from there • Only one URL specified to POST images management of albums via the desktop application Ideally user should enter login information for each site into application Photo Upload This makes it difficult for naive users to interact with Foton users and also for programmers developing API based Requires excessive user • Desktop applications can Hence POSTing images to specific albums is difficult request list of albums and photos easily • Functionality to upload photos to specific albums can be implemented quickly for Picasa API documentation • Simple and comprehensive • Poor and convoluted. Forums are more helpful than official documentation. 8 FOTON 6. Suggested API Framework for image/video distribution Based on our experience with coding our application, we propose a set of simple API method signatures which future websites can implement for easy incorporation of their service into Foton. 6.1 API signatures for image distribution • Key AuthenticateUserCredentialsForMyWebsite(username,password); o This method authenticates the user with the concerned website and returns a key to encrypt user session for security purposes. Example: long AuthenticateUserCredentialsForFacebook(String username,String password) • Albumlist GetAlbumList(username); • PhotoList GetListOfPhotos(AlbumID); • AlbumID CreateNewAlbum (albumName); • DeleteAlbum(albumName); • PhotoID UploadPhoto(AlbumID, username,Photo); • DeletePhoto(PhotoID); 6.2 API framework for video distribution Based on our design and implementation of Foton and the lessons we have learnt in the process we would like to propose a simple programmer friendly API development framework for video distribution. Below we outline the important characteristics. 9 • Authentication • Maximum size of the video • Video formats supported • Maximum videos allowed • Albums (optional) FOTON The general functionality which each video hosting service has to provide will be as follows. 1. Authenticate users. Here we find the Picasa approach to simple authentication attractive 2. Methods to determine maximum size of video. When we extend Foton to video, we need to take care of this special restriction which varies from one site to another. Since videos are involved there is practically no limit to how large the file can be. A user may want to upload a large sized video to all the sites he has subscribed to. For pictures size was not an issue as such but for videos many sites impose restrictions on the size of each video. APIs implementing methods to get the maximum size allowed for each site are therefore required to report errors. 3. Methods to determine if one has run out of allocated space for a particular site. 4. Methods to determine what formats are supported. In case some video format is not supported by a site, user can thus take remedial action such as converting his video from a non-recognized format to an acceptable one. 5. Some sites may allow users to organize videos into albums as it is naturally desired. In that case, again we find the album functionality offered by Picasa good enough. A general comment with regards to API development would be the use of error codes. For example, for points 2, 3 and 4 above which deal with the size restrictions for each video file and all videos taken together, we can assign error codes which will inform Foton exactly what has happened rather than Foton calling each method for sanity checks. With error codes, Foton will directly try to upload the video and if for some reason the site does not allow the new video, it will return the corresponding error code to Foton. Below we suggest API signatures for video distribution. •Key AuthenticateUserCredentialsForMyWebsite(username, password); o This method authenticates the user with the concerned website and returns a key to encrypt user session for security purposes. Example: long AuthenticateUserCredentialsForFacebook(String username, String password) 10 FOTON • Albumlist GetAlbumList(username); • long getMaximumVideoSize (username); • long getTotalVideosLimit (username); • VideoList GetListOfVideos(AlbumID); • AlbumID CreateNewAlbum (albumName); • DeleteAlbum(albumName); • VideoID UploadVideo(AlbumID, username, Video); • DeleteVideo(VideoID); 7. Future Work We aim to extend Foton for other sites (photo and video) and embark on automating login to sites which do not provide APIs. 8. References http://www.flickr.com/services/api http://code.google.com/apis/picasaweb/overview.html 11