Monday, July 26, 2010

Image Search Options Firefox Extension

Its been out for a while now, and is pretty easy to use, but I'll quickly cover some of its more interesting features...

Custom GET Options:
First off is the 'Options String' setting. This can be used to pass customized GET variables to the various sites. If you wanted to set the variable "blah" to "foo" you would type into this field "&blah=foo". Whatever is placed there will be inserted directly into the URL.

A practical example for SauceNAO would be "&accept=1" which will automatically bypass that pesky warning screen. This is particularly useful if you do not wish to accept SauceNAO's delicious cookie.

POST Image Search:
Another incredibly useful feature is POST image submission. This allows you to directly search for images that are behind login screens, on your local network, or are for whatever other reason not directly accessible to the search site.
When this feature is enabled, and the user right clicks on a NON-BACKGROUND image, right clicking on the context menu option will initiate a special query sequence. (doing so on a background image will perform a regular search.)
Now, the way this feature works is somewhat peculiar, and if you know of a better way PLEASE let me know!

First it will load the selected image into an invisible canvas element. That canvas element is then converted into a base64 png data URI which is then atob'd, placed into a stream, and POSTed to the selected site. Are you clawing your eyes out yet?

The extension then opens a new tab/window/etc and has it load the selected site's search url without an image so that relative links work properly, and then uses javascript to replace the page's content with the data returned by the POST submission.

Not surprisingly, this method has a few significant problems... First off, when the new tab is opened, it will temporarily display a page without results, or an error message until the POST finishes. Secondly, the page source of the POST submission results can not be viewed in the 'View Page Source' window. And lastly, somewhere in the conversion to canvas element, to data URI, to binary data, to binary stream, large images get improperly truncated. This effectively crops the large images to their upper left corner. I'll be looking into this one more, it's probably something stupid, but for now only reasonably sized images work perfectly~

Other cool but fairly self explanatory features include:
  • Being able to turn off certain sites! - You don't actually like IQDB or TinEye do ya? Or don't tell me, you hate SauceNAO... ;P
  • Renaming any of the Context Menu options. - The defaults are sooo lame.
  • Turning off the menu options for background images. - They're usually not what you want to search for anyway.
  • Changing where the results open! - Why settle for a new foreground tab? You can have a new window, a background tab, etc~

1 comment:

  1. I think its not working anymore.
    Every time is use it, it just goes undefined or says error.