I've not been successful in searching for this answer, but basically, how can I find the image file name from a website that blocks saving of the images? Normally, the url source will have the image filename and it is easily searchable.
However, some sites lets you hover over the picture and it then zooms to a larger image. The source shows,
for example,
http://example.com/pictures.aspx?ImagePath=ABCDEFGHIJ1234567989KLMNOPQRST==.....
E.g.: A random long string of code, but no .jpg or .png indicating the file name. When right clicking to save, it shows the image is blocked.
How can I get the images using Android code?
Tks
If it's not allowing them to be taken from a website, then it probably shouldn't be taken. That being said, there are a couple of options if you are the owner of the website.
If they are in a database then you can get the url address of them. Also, right clicking anywhere on the page to "View source" should get you some sort of URL of the image.
This seems more of a web service implementation issue rather than anything andriod specific. Many websites have this feature where you are not meant to retrieve information from the url.
However there should be a corresponding supported web service interface for fetching the metadata of a particular resource. If this is not supported then it's meant to be blocked.
The other trial and error sort of way is to invoke a 3rd party API like oEmbed (or Embed.ly : http://embed.ly/) that would return the metadata of the resource for which you have the URL. These services cover a wide range of websites and their resources.
You can search around in their site or find similar such services that would get you this information. Embed.ly is more of a personal preference due to its exhaustive list of supported sites.
Related
We have our own Artwork and photography images uploaded in different websites like Tumblr,500px,Deviantart,Flickr etc.So for every image there will be already some URL which is publicly available for everybody to view or download.
Example of such a URL is : http://40.media.tumblr.com/b12772f7533b6283ca008ba8d7ec2192/tumblr_nsezua4hur1r4xqayo1_500.jpg
Like there will be a lot of URL, and we are able to show this in our app and app let user to download this URL. Since the server is not our own, But the images are our own, are we allowed to use these urls in our app to show as a gallery app and let the user download it to their own.
Is it allowed? This is related to programming, because we have seen same websites providing their own APIs to fetch data. But we dont want too many details, Our requirement is simple, So we are trying to keep it simple and economical.
You should be fine, but check that the URLs don't change, or you'll be left with a lovely little error.
I'm developing a gallery app and I want it to be compatible with the Chromecast.
I searched and tried for days but I can't get it to work. I learned that I need to create a webserver (NanoHTTPD) and send the url of the image. Can someone show me a simple tutorial?
If I have the path of the image, how can I display it in the simplest way possible?
Thank you!
There is plenty of examples and resources that show you how to cast a video, so familiarize yourself with that. Then, for sending an image, you need to follow the same steps but your MediaInfo object that represents your item (image in this case) needs to have its URL set to the url of the image, served by your embedded server (for example, if you put that url in your web browser on your laptop on the same network, you should be able to see the image). Then load that media item the same way you would load a video. For the simplest solution, you can use the default receiver; it supports images.
I have encountered a strange problem I am unable to debug. An image is uploaded to Onedrive via some code very similar to the given example, and once uploaded, the image is visible in the OneDrive web interface.
http://msdn.microsoft.com/en-us/library/dn659727.aspx
Upon trying to download it, again using code from the example, the following line of code
Bitmap bMap = BitmapFactory.decodeStream(input);
also returns a null value for bMap. I know these files (which I obtain from copying from the Android Clipboard and writing to a file on disk) are valid, b/c I use them in Gridview elements and upload/download them to Dropbox in a similar way.
Is there some kind of jpg re-encoding performed in OneDrive (like RGB->CKMY conversion) what would no longer prevent them from working?
Also, is there some other type of query parameter like "/picture?type=thumbnail" or "/picture?type=normal" that needs to be appended to a file.XXXX OneDrive ID that would prevent any possible conversion?
Is there a way to debug exactly why the BitmapFactory.decodeStream() function fails, like debugging output?
EDIT: So, I came across the following SO post, and figured out this is the same problem I am having.
OneDrive - Wrong size for PNG files
For a certain file, if I download it using the Onedrive SDK and look at the stream length
public void onDownloadCompleted(LiveDownloadOperation operation) {
int length = operation.getContentLength();
}
it reports a size of 2723 bytes, but if I download the file and save it using a desktop web browser, the file is 1837 bytes. Is there something I am missing about reading the size of a stream, or is the API just broken?
This is documented behaviour as per http://msdn.microsoft.com/en-us/library/dn659726.aspx (see the first note under uploading).
You can disable conversion by adding downsize_photo_uploads=false to your query string.
The answer to this question apparently is, there is a bug in the Onedrive SDK. I ended up filing an issue on Github with Microsoft, and it turns out they discovered that with certain types of small images (and potentially PDFs), the actually file size being transmitted back after a download is wrong.
https://github.com/liveservices/LiveSDK-for-Android/issues/37#issuecomment-65457177
It's all just a weird artifact of the way I was testing my app. Since Chrome for Android is the only app I've discovered that lets you copy an image to the clipboard, I was just Google search to find images (tiny thumbnail images in the basic web search results), and copying those to the clipboard. Had I been using larger images, I may never have run across this bug.
I've a php application that allow you to change your Timeline Cover picture posting a photo to an album, and with the retrieved ID, redirects you to:
http://www.facebook.com/profile.php?preview_cover=[photo_id]
Also, if you paste directly that link on your browser with a valid ID, it works perfectly.
But on android it does not. Even if I change to-
http://m.facebook.com/profile.php?preview_cover=[photo_id]
What's the way to do this on android?
In case others come across this -
I haven't found a way yet to change the cover photo image within the m.facebook.com environment.
You can, however, add &ref=pb to the end of the URL to force the Desktop experience in mobile.
This isn't ideal, but does allow the user to set their cover photo:
http://www.facebook.com/profile.php?preview_cover=[photo_id]&ref=pb
If I come across a better implementation, I'll update this post.
I've downloaded Google drive sdk for Android,
the API is not well documented, so I didn't manage to get to conclusion if what I want to do is possible.
I want to capture an image with the camera convert it to black and white pdf, and then perform OCR on it to get the fields I need as String.
Do I need to send a server request for it or maybe I can Do it on the client side only using Drive api?
sample code will be helpful.
Google's docs don't specify what happens to an uploaded file when you request OCR, specifically, they don't tell you if there is a response string.
However, a little experimenting shows that the only way to get the OCR data is to lookup the document after OCR is complete and grab the text.
You'll find the data structure for 'Files' here: https://developers.google.com/drive/v2/reference/files#resource - what your are after will be in "indexableText" as a string.
Unfortunately, it won't parse out any sort of 'fields'. That would require an understanding of the content... Also, it doesn't seem to capture any email addresses, which is an issue if you are trying to do business cards.
BTW, you will have to wait some time, upto 2 minutes, before the data is available. I'm not entirely sure, but it could also be that object id will not be available for that amount of time, so you might have to either run a background process or do something else.
Sorry that you didn't find the documentation, it is plentiful and available here: https://developers.google.com/drive/
The entire Drive API functions by making server calls, please check here: https://developers.google.com/drive/v2/reference/files/insert for how to perform OCR on uploading files to Drive. Look at the cunningly named "ocr" parameter.