Get MimeType of Image by Javascript in Chrome - mime-types

For some image elements in a web page, the file extension is not provided. Here is an example.
http://c.fsdn.com/allura/p/pdfsam/icon
How can I get the image's mimetype by javascript if the file extension is not provided? If possible I am looking for a solution that does not require to get the mimetype detail from Ajax or Network connection. I am looking something like a DOM property:
img.mimeType
I am try to get the detail for Google Chrome.

Related

How can I embed a URL in an image in Salesforce surveys?

I'm new to Salesforce surveys and I'd like to embed a URL (for this example, https://www.google.com) in an image. I've tried following their documentation here but it's a tad confusing. The survey's editor doesn't give any built-in options - this is what I have right now:
In a wild attempt I tried:
To no avail - it just displays the plain text in production. How can I embed a URL in an image (if possible)?
After researching a bit more I found this here:
"..Upload Image and select an image from your local host. You can upload only JPEG, PNG, or GIF files. The file cannot exceed 1 MB. You can’t add a hyperlink to an image. Copying inline images from external sources to the text editor is not supported."
Looks like it's not possible :(. I'm still searching for a workaround if one exists.

Angular Fallback Image With Status Code

I'm trying to get a fallback image working that behaves differently based on the status code. My images are coming out of SharePoint and in certain (Microsoft) browsers I have to request the images through a Web API so that I can append the proper authentication cookies.
I already have a fallback working that if an image fails it requests the image through the Web API and gets the Base64 representation. The problem is there's no point doing this if the image isn't there. So if it's a 404 I'd like to just display the placeholder, but if it's a 302 I'll get the image a different way.
Checking the error object and all the fallback directives I can find, I can't see a way to find out the error code.
Thanks!

LinkedIn share links to PDF documents

I am trying to create buttons on a web page that allow users to share links to PDF documents on LinkedIn. LinkedIn loads a window without any errors but offers no link or preview of the PDF or any indication of what is being shared.
Here are the two methods I have tried. First the plugin method.
<script type="in/share" data-url="http://example.net/DocumentDownload.aspx?Command=Core_Download&entryID=114"></script>
And, secondly with a custom url.
TEST
Encoding the url makes no difference.
The above links are direct document links from a DNN web site using Document Exchange. If I change the urls to any html page it works fine and LinkedIn seems to be able to extract the useful information right from the page and use that for the share details.
Can LinkedIn handle this kind of thing? There is nothing to guide me on the type of links that can be shared. I can't find any information about it. There are no errors in the web console.
Not sure, but you should try to provide LinkedIn with the link that has .pdf at the end, like http://example.com/documents/file1.pdf. I guess LinkedIn just checks the URL if it has .pdf file at the end to decide if it is a PDF document or not.
I have no problem sharing pdf's on LinkedIn. Check it out...
https://www.linkedin.com/sharing/share-offsite/?url=https://www.revoltlib.com/anarchism/the-conquest-of-bread/view.pdf
Works perfectly fine. And view.pdf is a script, not a file, either, so, it's not looking for a PDF file to analyze, so much as headers that indicate you have a PDF file available to analyze, so, in PHP, at DocumentDownload.aspx, we would do...
header('Content-type: application/pdf; charset=utf-8');
This header let's the sharing app know that it can analyze the document as a PDF file and extract useful information from it, as you can see from the screen shot.

Customise AppEngine Image Service Serving Url with type extension

What I would like to achieve is to let AppEngine Image Service to generate a serving URL with file type as an extension.
For example, in my local, a serving url may look like:
http://0.0.0.0:8898/_ah/img/u4EXyF53eLVd8s5wHrE3tg
Is it possible to override it into the form of something like
http://0.0.0.0:8898/_ah/img/u4EXyF53eLVd8s5wHrE3tg/filename.jpg
The reason I need to do this is I am using Flowplayer and hope to add a splash image by using the playlist function. However, it looks like Flowplayer won't recognize image file without a proper image extension.
There are no "files" on the web, just resources. And every resource has an Url. The type of the resource is defined by Content-type header. There is no such thing as "file type as an extension" on the web.
Image service sets the Content-type properly so all standard clients should be able to display it.
Also, it seems that Flowplayer splash images are just a normal images displayed in HTML, so there should be no problem with this.
Can you display your Url normally in HTML?
Actually there is a workaround for the solution.
Basically, you can add a fake query parameter at the end of the url, and Google will treat them the same.
So, for instance, a url http://0.0.0.0:8898/_ah/img/u4EXyF53eLVd8s5wHrE3tg, you can make it
http://0.0.0.0:8898/_ah/img/u4EXyF53eLVd8s5wHrE3tg?.png or http://0.0.0.0:8898/_ah/img/u4EXyF53eLVd8s5wHrE3tg?.jpg
depending on your need. Google won't care about the query parameters, but I got what I need and my client software (Flowplayer) is happy about this new link.

With using htmlagilitypack how can you determine whether URI is file or not

For example for this url it does not show it as file
http://www.darty.com.tr/e_commerce/ximg/yeniyil/darty%20garanty%20brosur.pdf
But it is a pdf file. So what i want is simply determine all of the urls which can not be crawled like pdf or doc or docx etc. How can i do that with c# 4.0 and htmlagilitypack ?
Thank you.
Does not recognize as file : http://img695.imageshack.us/img695/61/notshowasfile.png
Uri is part of the base .NET Framework -- this has nothing to do with the HTML Agility Pack.
This also has nothing to do with it being a PDF. The documentation for Uri.IsFile says:
The IsFile property is true when the Scheme property equals UriSchemeFile.
In other words, IsFile answers the question, "Is this a file:// URI"? Since this is an http:// URI, the answer is no.
You seem to be confusing URLs with content. A Uri is just a fancy string; its job is to be a URI, not to go out to the server and ask questions about the content at that URL. "Is this a file type I know how to crawl?" cannot be answered by looking at the URL; http://example.com/articles/123 could be a Web page or a PDF or a text file or a JPEG or any of a thousand other things. You have to do a GET or HEAD request to the server, and look at the returned Content-Type, in order to know what type of content that URL represents.

Resources