Is there any way to make sure that an image is not taken from google but instead the user's phone camera? - image

I want to only allow images that are taken directly with the phone’s camera on my website. Are there any APIs or tricks that could help me tell if an image is authentic and taken with an iPhone or Android camera a few moments ago and not taken from Google Images.

Hi drstuggels they are a few ways to go about this.
WebRTC
To prevent upload from any file, take picture directly on your web interface, via the user webcam.
You would need to
Ask permission to the user to use the webcam.
Open the video stream
Capture on click the frame
Save the frame
This would prevent lambda users from uploading picture "not live".
If this is a solution you are considering, look for WebRTC. Although there are many blog post showcasing demo for this exact use case.
Such as:
https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Taking_still_photos
EXIF validation
As mentioned by iѕєρєня, you could try to access the EXIF metadata of the uploaded picture and run a validation mechanism, for let say freshness but looking for date and time field (if you are looking for a newly taken photo) or the camera model field to make sure it was taken by a camera (phone, DSLR, etc..).
DISCLAIMER:
Nothing will prevent a malicious user from tampering with the js code or file to upload fake picture.

Related

Best way to protect copyright on images

We're building a startup centred around assets users would sell on the platform. We need to provision our users by giving them a way to protect their copyrights on images/videos they're uploading. Of course, it is not possible to remove any chance of misuse, but we would like at least to minimise it, using the following identified options:
Add non-distraint watermark to images. Only when users buy an image/video they would get the original/"clear" version
Using Google Reverse Images API to check the web for images and eventually show the user where the similar images are uploaded (can also be used for videos by taking a screenshot)
Add copyright information to each image metadata.
Is there something else that we can do?
The second part is getting some insights in assets reusage
Is there some API on Facebook and other social networks to check how many times certain image is uploaded / re-shared / liked / commented etc ?
Any information on the topic is welcome.
Thanks in advance

Thumbnail is broken when google drive is synced

I'm getting the thumbnail of a document using file.get API, which is stored the field thumbnailLink in the drive response. But after some time, I get only a broken image.
Could you please let me know the exact expiration time of the thumbnail, which determines the expiration time and how to extend it? We can download the thumbnail image, store it in the cloud and then use it. But since the users are many and the documents are many and the thumbnail varies based on the changes, so I don't think this would be a better approach. I wanted to know whether we have any workaround to fix this issue? Do we have anything to play with the google cache? If so, how to do? will this be a permanent solution
As stated in the documentation
Important: Thumbnails are invalidated each time the content of the file changes. When supplying thumbnails, it is important to upload new thumbnails each time the content is modified. Metadata changes do not invalidate thumbnails.
The google drive thumbnail image link changes the file is changed.
You will need to refresh it if the link is bad by doing a file.get or upload new thumbnail image metadata whenever you change the file.

Given a URL of an image, how do I upload that image to the Facebook user's album? [duplicate]

This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
Upload photo to users profile from photo URL, not input file field
I have the access_token. It's with the publish_stream permission.
Alright, now I want to upload an image to my default app's album on Facebook. The image is hosted on my S3.amazon.com. (but for example purposes, let's take this link: http://i.imgur.com/Ptyzk.jpg)
How can I upload this imgur image to my app's album? (documentation on Facebook is weird, and I don't understand PHP).
To upload photo to "Application Album" you have two ways (actually first may interest you more).
Option 1: Uploading Photos to the Graph API via a URL:
App developers who host their images on Amazon S3 or a similar service can pass the S3 URL directly to Facebook without having to download the file to their application servers only to upload it again to Facebook. This improves performance and reduces costs for developers.
To achieve this you need to issue POST request (or GET with argument method=post) to next URL:
https://graph.facebook.com/me/photos?
access_token=...&url=http%3A%2F%2Fi.imgur.com%2FPtyzk.jpg
http://i.imgur.com/Ptyzk.jpg in url encoded form is http%3A%2F%2Fi.imgur.com%2FPtyzk.jpg (you only need to encode url if you passing it withing URL arguments, and must not encode if you passing it with post-data).
As stated in photo object documentation, by posting photo to https://graph.facebook.com/USER_ID/photos:
The photo will be published to an album created for your app. We automatically create an album for your app if it does not already exist. All photos uploaded this way will then be added to this same album.
Option 2: Uploading image data
You just need to issue POST request to http://graph.facebook.com/me/photos (see Create Photos section of user object documentation).
The only required parameter is source which is multipart/form-data encoded file, you can either download it to temporary file and upload it later, or stream it to the Graph API (depending on technology you use to implement this functionality)
There is couple of samples how to upload photo (in languages other than PHP):
Android SDK samples (Hackbook)
Facebook C# SDK (on Codeplex)
Update:
It's not really clear where do you want photo to be published User's album or Application album (title and body of question are opposite on this). If you want to publish it to User's album you need to replace me with id of album you want photo be uploaded to. Otherwise use me (for current user) or other user id (this will require usage of application access_token).
This tutorial does exactly that:
https://developers.facebook.com/blog/post/498/
You can choose which album you want to upload the picture to.
If you want to do it on a more generic way, Facebook API tells you to issue a POST request to ALBUM_ID/photos with source and message parameters. Note that source must be of multipart/form-data type.
More details at https://developers.facebook.com/docs/reference/api/album/
I think the majority of this answers are correct if you would like to upload that photo to a user of your app. But as I understand you want to upload it to your app's connected album. To do that you should get you app album's id than you'll be able to post an image to it like:
$facebook->api('album_id', 'POST', array(...
To get the id of the album go to the Graph API explorer and do a GET to: /your_app_id/albums (replace your_app_id with your actual app id). That should give you all the details about your app albums. Than do a Graph API POST request using your preferred SDK (JS, PHP etc.) with the array containing the picture source and a title (this are mandatory) to the above address.
NOTICE: The album application connection is deprecated and will be removed on March 1st, 2012. Read more at the end of this doc http://developers.facebook.com/docs/reference/api/application/

Dynamically shrink an image with Google Images API, but do not enlarge

Google provides an excellent way to resize images dynamically; simply append =sXX to the image URL. This is perfect if you want to shrink an image, but if the image is smaller than the size specified, it enlarges it, giving it a pixelated effect.
Is there an easy way to say "don't enlarge, only shrink" when using serving URLs with a specified size?
UPDATE
This functionality is now a feature request at GAE. Vote it up if you'd like to see it!
As stated in my comments above, this isn't possible.
Although I have no use of the image framework I can see how your request would be useful. May I suggest posting a Feature Request on the Google App Engines Issues BB?
After posting the request, update your StackOverflow question with a link to your Feature Request so that other users can +1 the request.
Here's the link to the GAE Issues Page. Although this is not a bug, you will need to click the New Issue button to request a feature.
What you could do is store the size of the image in the datastore so when you need the image to be a certain size, you can check in the datastore to see what size it is and add the =sXX accordingly.

Resize large images in App Engine

I've got an app on Google App Engine that will accept image uploads from users. The problem that I envision is that users will upload these images directly from their cameras, and file sizes are often greater than 1MB, which is the limit for the image API (which would be used to resize the images).
What's the best way to accept the upload of say a 1.5MB image file, and resize it to under 1MB?
While this is not clear in the App Engine documentation, this is possible by using a combination of the Blobstore and the Image Manipulation Service.
You must:
Upload the Image into the Blobstore
Retrieve the Image from the Blobstore
Perform the Image Manipulation with an Image resulting in less than 1mb in size
I've written up a post about this -> http://socialappdev.com/uploading-and-re-sizing-large-images-on-app-engine-11-2010.
Here are two (similar) ways to solve this:
If you want to keep everything controlled yourself, you can put a resize script on a server of yours, which takes the URL to the raw uploaded image (which can be up to 10MB due to HTTP response size limit, but you would have to store it as 1MB chunks in the datastore), downloads it from your application, resizes it, and then POSTs it back to your application. All this interaction would need some kind of authorization of course, so that it can't be abused. Alternatively, POST the image directly to your external server, but then you have to either send the other form data back to your application, or use a separate form for the image upload.
Use an external imaging service. I would recommend Picnik. See their API documentation. As you can see, it lets you make a form that posts the image directly to their servers, then the user can edit the image (and resize), then the image is posted back to your server. With this solution you have to upload the image in a separate form, since Picnik receives all your POST data.
I recommend point 2, because it doesn't require you to go around Google App Engine limitations and since your users are uploading images straight from the camera, they will probably want to do something with them anyways (such as crop.)
That's a conundrum. The "obvious" answer, using google.appengine.api.images.resize, won't work because it's too big. :) So you will have to use third-party software, either on the server (which will be tricky because of App Engine's limitations) or the cilent (e.g. a Java uploader).

Resources