How to count total photos on iphone - iphone

I am trying to count total photos on the iphone and get the total filesize. What is the best way?

At least in 2.x SDKs, you can't access actual photo files programmatically from code. However, you can access thumbnails of photos which you can use to get a count of photos.
Original photo themselves are in a special database file (/private/var/mobile/Media/Photos/Photo Database) and thumbnail pictures are in a directory (/private/var/mobile/Media/Photos/Thumbs).
Photos can be accessed only through interactive UIImagePickerController. Reverse engineering Photo Database file format is the only way I can see that would give you an access to original photo files programmatically.
I haven't checked the situation for 3.0 SDK, it might give you some API to access photos programmatically.

Related

Creating a Post with a larger photo size

When using the Facebook Graph API and including a Picture with a post, the picture always appears as a small thumbnail. Is there a way to make the picture larger like it appears when you upload a photo and share it?
No, the size of that photo is controlled by facebook and the only thing you can do is playing around with the relative size of the photo you use so that it would look slightly bigger (you should use pictures with landscape layout as opposed to portrait to get a 'slightly' bigger photo.
The hack you can use to do that is what apps like Instagram and Path did: Each time someone uploads a photo, they upload the photo to an album named "Instagram/Path photos" and include the link to the original photo in the caption (in your case,the link to the original article).
However, in order to do that, you users must grant you additional permissions on Facebook and they may not like the idea of uploading photos to another album, so I (personally) wouldn't go that way.

phonegap get photo file's original imageURI

phonegap's camera API has this iphone quirk noted:
When destinationType.FILE_URI is used, photos are saved in the application's temporary directory.
details here
and when I load the photo from album, I get imageURI like this
file://localhost/var/folders/sV/sVG0cyUrFvKs6+6I16IO+U+++TI/-Tmp-/photo_007.jpg
and every time I get a different URI for the same photo. Is it possible to get the URI of the original photo file instead of the temporary copy? I need to have the image URI and display multiple photos on the same screen.
Thanks for your help.
Actually it is not possible on iOS as the photos are stored in an area that is not accessible via URL. We need to copy the image to the application specific temp directory so it will be readable by your app.

How to identify photos that were downloaded from Facebook

Is there any kind of metadata in photos that Facebook processes that could be used to figure out if a photo originated from Facebook?
For example, is there any data I could extract from a resized jpg file downloaded from Facebook using ImageMagick or some other tool?
I don't see any way to do this right now other than to guess by filename (which I don't have in this case) or by dimensions.
AFAICS there is no way to discover any special metadata or EXIF data in photos that are downloaded from Facebook.
'Originated from Facebook' (your expression) in any way is wrongly stated. People upload lots of stuff to Facebook, but that doesn't mean it originates from there...
If you can provide any sample of fotos you are thinking of, one could start investigating a bit closer....

how to implement photo album application?

I am implementing photo album application same as default photo album application in iphone.
can any body suggest me how to start?
I've written a simple and easy to use photo browser called MWPhotoBrowser. I decided to create it as Three20, while very good, was too heavy/bloated as all I needed was a photo viewer. Take a look:
MWPhotoBrowser can display one or more images by providing either UIImage objects, or URLs to files, web images or library assets. The photo browser handles the downloading and caching of photos from the web seamlessly. Photos can be zoomed and panned, and optional (customisable) captions can be displayed. The browser can also be used to allow the user to select one or more photos using either the grid or main image view.
Have a look at the Three20 project started by Facebooks Joe Hewitt, it contains several reusable controls like a photo viewer which mimics the iPhone's Photos app.
"TTPhotoViewController emulates Apple's Photos app with all of its flick n' pinch delight. You can supply your own "photo sources", which works similiarly to the data sources used by UITableView. Unlike Apple's Photos app, it isn't limited to photos stored locally. Your photos can be loaded from the network, and long lists of photos can be loaded incrementally."
http://github.com/facebook/three20/

How to replicate facebook photo view and show photos very fast from web

I have to create same functionality as facebook has does like all the photos display at one view and from that user can choose photo and it goes to large photo. This photos are showing very fast. I have 5 photos from web but it take so much time. Does anyone know how they shows photo very fast.
I don't know the answer but I suggest you look at the three20 source code on github. Joe Hewitt (who wrote the Facebook app) published much of its code including the photo view. There is also a Google group that discusses three20.
I don't know about the iphone app in particular, but I do know that the main facebook website prefetches images in photo albums.
Facebook creates multiple sizes of each photo when it is uploaded. They also convert all the photos to png I'm pretty sure, likely reducing the file size of the original photo. I know creative has often complained about the "quality" of photos after uploaded to Facebook.
This allows them to deliver the appropriate sized image (both dimensions and file size) for quick display rather than delivering a full sized image and having the client resize it.