How to find someone changed their Twitter profile image? - image

Say, with in my application, I have a list of friends (Twitter IDs) the user follow. I show their name and their image (from Twitter). Every time the user logs into the application, I want to get the recent profile display image from Twitter.
How do I know, someone changed their Twitter profile image?
Currently, I think, I need to get their image (I use Twitter API: GET users/profile_image/:screen_name) and find the modify time and if it is not newer, I assume it is not changed. Is there a better way of doing it? How would you do if you have to built something like this? I hate getting all the image files and checking them one after one. I hope there is a better way to get the images of those who have made a change to their profile recently.

You can try looking at http://api.twitter.com/1/account/verify_credentials.json and see if anything in there tracks profile changes although I doubt it. (Try using: https://dev.twitter.com/console for an easier interface).
If you can't find anything in the API, then there is not way to know that the profile image has changed without checking. In which case, you can store a hash of the old image, and compare the hash of any new images, and see if they match. If they do not, then you know it has changed.
Hope that helps.

Related

I'm looking for an image sharing service

To explain it briefly, I'm trying to share the image as a URL.
But I need to update the image and I hope the URL doesn't change every time.
In other words, I am looking for a feature or site that can update images to the same URL.
I would appreciate it if you could let me know if there is a similar or the same service.
The way that comes to mind now is to add an image to the imgur and go out. We are looking for an alternative because the URL is the same, but it is a way to list images rather than just one image.

Profile image gallery provided by database

I'm currently working on profile images for my registered users.
As of now my users can upload their own images to use and of course there's a default image, incase users don't upload a picture.
By the way, I'm using the Paperclip gem.
I've been trying to do so that my users can choose to select an image from a list of images, provided by the website/database.
This website: https://satwcomic.com/ has exactly what I'm looking for.
Example from the website.
I've been trying to find a solution for this for the past month, but without luck. any hints on how i could successfully achieve such feature with or without paperclip?
I'm hoping to get pushed in the right direction.
Please do keep in mind, I'm still learning Ruby on Rails as a student and any help will be appriciated.

How to download images for reduce network usage?

I am making android app that must show a lot of images from my REST API. I want to download images, and the next time check for images' name. If the image exists show them from the phone otherwise download from server.
Now I'm using Retrofit for my network requests and Glide for show images. But I have not good idea for solve this issue.
If needed I can change the network library or image loading library.
Thanks in advance
NOTE: This question might be too broad for the liking of S.O.
What you want to do is make what is known as a cache. The idea is that you have a unique identifier (often refered to as a key) for each object in the cache, such as an md5 sum of the image data, or original name + date of creation.
When you want to display an image, you first check if the image exists in the cache. If it exists simply return with the image from cache. if it does not exist, start the download and upon completion you insert the image into the cache.
Here is an example implementation that does what you want. I cannot vouch for it's quality because I never tried it.

Retrieving .swf from website

I was wondering if you guys can help me out. Im making a website for an authorized Dish dealer. Ive been trying to retrieve the flash animation on dish.com. I was able to get it through firefox with 'Page Info' but all I get is a black rectangle without no animation. Its a .swf, any help is appreciated.
There are a couple of possible issues there.
There's a chance that the movie is loading something from that domain, which will not get loaded when the container movie is loaded in another domain due to cross-domain policy issues (and security sandbox restrictions).
Also, in its code the developer might have made it to check the URL and restricted some actions accordingly.
Another possibility is, it might be using some data that it gathers from the page source, or a server-side script which you might not be providing it.
These are the most likely possibilities I can think of, but if I get a chance to think more I'm sure I can come up with many others.

Logging image downloads

I'm trying to find a way of finding out who is downloading what image from an image gallery. Users can download using a button beside the thumbnail or right click and use the "save link as" Is it possible to relate a user session or ID to a "save link as" action from all browsers using either PHP or JavaScript.
Yes, my preferred way of doing this would be via PHP. You'd have to set up a script which would load up the file and send it to the user browser. This script would also be able to log the download somewhere (e.g. your database).
For example - in very rough pseudo-code:
download.php
$file = $_GET['file'];
updateFileCount($file);
header('Content-Type: image/jpeg');
sendFile($file);
Then, you just have your download link point to download.php instead of the actual file. (Note that updateFileCount and sendFile are functions that you would have to provide, of course - this script is an example of a download script which you could use)
Note: I highly recommend avoiding the use of $_GET['file'] to get the whole filename - malicious users could use it to retrieve sensitive files from your web server. But the safe use of PHP downloads is a topic for another question.
You need a gateway script, like ImageDownload.php?picture=me.jpg, or something like that.
That page whould return the image bytes, as well as logging that the image is downloaded.
Because the images being saved are on their computer locally there would be no way to get that kind of information as they have already retrieved the image from your system. Even with javascript the best I know that you could do is to log each time a user presses the second mousebutton using some kind of ajax'y stuff.
I don't really like the idea, but if you wanted to log everytime someone downloaded an image you could host the images inside a flash or java app that made it a requirement to click a download image button. That way the only way for them to get the image without doing that would be to either capture packets as they came into their side or take a screenshot.
Your server access logs should already have the request for the non-thumbnailed version of the file, so you just need to modify the log format to include the sessionid, which I presume you can map back to a user.
I agree strongly with the suggestion put forward by Phill Sacre. For what you are looking for this is the way to go.
It also has the benefit of being potentially able to keep the tracked files out of the direct web path so that they can't be direct linked to.
I use this method in a client site where the images are paid content so must be restricted access.

Resources