How to get user profile Image in big size from Twitter timeline object in iOS - ios

I use twitter API fetchTimelineForUser:(NSString *)username to fetch tweets timeline. The size of user profile image in this object is normal. But I need a bigger size image.
How can I accomplish this?
BTW, I don't want to fetch the user object from twitter.
Thanks.

In profile image url you are getting _normal, appended with the image name like http://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3_normal.png
To get actual image remove _normal. It will be http://pbs.twimg.com/profile_images/2284174872/7df3h38zabcvjylnyfe3.png

You can see profile_image_url and profile_image_url_https in user object, normal sized image is mostly 48px - 48px. By modifying the url you can get larger image.
For more info please see this link.
Hope this helps.. :)

Related

How to take screen shot including URL & Task bar in cypress?

enter image description here
How can we cover the URL & task bar in Cypress in as "screenshot" as per the attachment?
We have already used below method but still not get the exact result.
cy.screenshot({capture:'runner'})
I tried this method "cy.screenshot({capture:'runner'})" but still not get the exact result as per attachment
To take a screenshot including the URL and Taskbar you need to use capture as viewport.
cy.screenshot('myScreenshot',{ capture: 'viewport' });
This will capture the entire viewport and save the screenshot with filename "myScreenshot.png" in the default screenshot folder.

iOS, How to know whether a photo is a screenshot taken by user? How to delete photos in Photos?

In AppStore(China), an App called Tencent Mobile Manager released a series of functions related to photos, including detecting whether a photo is a screenshot taken by user, deleting photos.
I got screenshots of this app to demonstrate my question here (I added English texts myself for you since the app only shows Chinese):
This app knows what photos are screenshots and what not
When you tap Delete Button at the bottom, it shows:
Asking permission from user to delete photos
As far as I know, Photo APIs (AssetsLibrary, PHPhotoLibrary) in iOS don't give an absolute path of a photo, and iOS SandBox doesn't allow apps to delete user's assets as well, which makes deleting users photos almost impossible. All photos saved in iOS device follows the same naming system: "IMG_001.jpg", which makes it impossible to detect whether a photo is a screenshot from their names.
But apparently, this app implemented both functions. Does anyone have any ideas about this?
Thanks!
You can check using PHAsset's mediaSubtypes property.
let types = phAsset.mediaSubtypes /// phAsset is a PHAsset
let isScreenshot = types.contains(.photoScreenshot) /// true if is screenshot
For screenshot, its UTI is always a "public.png" and same size as screen (be sure you have multiply [UIScreen scale] on screen bounds width and height), just need to check these 2 metadata, you can easily identify screenshot.
Hope this will helps you

Uploading photos to e-Mail from Swift

I am writing an app that has a simple form with a photo upload tool, the user uploads their photo to the form and it is displayed in an image view, i then want that image to be in the blank e-Mail that opens up upon clicking submit. I am using the following code to try and achieve this:
let messageBody = "\n\nPhoto: \(imageView.image!)"
The photo gets uploaded and shows in the image view fine but the email displays the following where the image is supposed to be " size {1334, 70} orientation 0 scale 1.000000"
Any help would be greatly appreciated!
Your code (or my previous answer) won't work because you are converting the image to a string (messageBody). And it basically shows you a string of information about the image. So your only option is to write the message in HTML (and set isHTML to true). The good news is that it isn't too hard.
I think the code below should work.
let messageBody = "<html><body>Photo:<img src=\"yourImage.png\"></body></html>"

Unable to show contact image in shortcut items

We develop an app with some features in iPhone 6s.
I faced some issue when showing the contact image in the shortcut item. I am able to show the dummy image, but I am unable to dynamically fetch the contact image and show in the shortcut items.
My images are in documents directory. I need to show in shortcut item.
UIApplicationShortcutIcon iconWithTemplateImageName: --------]
I tried this:
UIApplicationShortcutIcon * photoIcon = [UIApplicationShortcutIcon iconWithTemplateImageName:SaveImage.png];
I can show a direct local image, but I cannot show the image from addressbook.
Any recommendations are welcome.
This question is confusing. You say your images are "in the documents directory", but you want to display images from the address book.
What I recommend doing is getting the contact you want from the CNContactStore (a CNContact has an image attribute named imageData) and then pass it to UIApplicationShortcutIcon which has an init method that takes a CNContact as a parameter (which means it would actually use that image).

Change image of three20 TTTableImageItem programmatically

i am using a TTTableViewController (three20 framework) for displaying user profile data (username, user image, etc.).
The tableview datasource is set up as follows:
_profileImageItem = [TTTableImageItem itemWithText:#"Change Profile Image" imageURL:DEFAULT_PROFILE_IMG URL:#"tt://photoThumbs"];
self.dataSource = [TTSectionedDataSource dataSourceWithObjects:
#"Profile Image",
_profileImageItem,
#"Profile Name",
_profileName,
...,
...];
When the user tabs the _profileImageItem, a UIImagePicker view is presented where the user can select a new image. After that i scale the image down and write it to the apps document folder.
My problem now is: How can i update the image URL in the datasource? Currently it still points to DEFAULT_PROFILE_IMG. Even when i update the _profileImageItem member using:
[_profileImageItem setImageURL:#"new URL here"];
the old image is shown. I have tried refreshing the view - same problem.
Any help is much appreciated.
Ok i made a stupid mistake.
TTURLCache was enabled and i updated only the image, not the path (i.e. i have overwritten the profile image). As the path is used as a key in the TTURLCache, the cache returned the cached image ;)
[[TTURLCache sharedCache] setDisableImageCache:YES];
solves the issue.

Resources