Thursday, May 10, 2012

Thumbnail Expansion Rules for Full Screen Image Viewer


(Thumbnail Expansion Rules samples are provided at the end of this post. You can copy&paste them to your extension for a try.)

Full Screen Image Viewer version 2.0 adds the possibility to view the original image of a thumbnail. Because the URI's of some thumbnails contain the information of the original images, with a little transformation, we can get the URI's of the original images. However, you must input the rules of the transformation into the Options dialog to make it work. To do it, open the Options dialog of this extension, click on the *Thumbnail* tab, make sure the option *Enable Thumbnail Expansion Rules* is checked, and input your rules in the textbox.

You must know JavaScript Regular Expression to build a rule. Each rule must be in one line and the items of the rules are separated by spaces (one or multiple, doesn't matter). For example, the rule to transform image search results from Google Images can be (in one line):

^http://www.google.[a-z]+/imgres   i   http://www.google.[a-z]+/imgres?.*&imgurl=([^&]+)&.*   i   $1

There are five items in this rule:

  • A regular expression to match the URI this rule applies to: ^http://www.google.[a-z]+/imgres
  • A modifier for the above regular expression, can be i or g or ig: i
  • A regular expression to match the pattern we want to replace: http://www.google.[a-z]+/imgres?.*&imgurl=([^&]+)&.*
  • A modifier for the regular expression of the pattern, can be i or g or ig: i
  • The replacement for the pattern: $1

Sometime the result from the transformation is URI-encoded. If so, you can instruct the extension to decode it by adding decode at the end of the rule, like this (in one line):

^http://www.google.[a-z]+/imgres   i   http://www.google.[a-z]+/imgres?.*&imgurl=([^&]+)&.*   i   $1   decode


In the textbox for the Thumbnail Expansion Rules, any line starts with // are regarded as comments and ignored.

We have some sample rules below and the list is growing. You can tell us yours or your wishes. Please understand that not all thumbnails contain the information of the URI's of the original images. The thumbnail can only be expanded when its URI can be transformed to the original's.

 

// amazon.com
^http://[^/]+\.images-amazon\.com/images/.*\._[^\.]+_\.jpg   i   \._[^\.]+_\.   i   .

// deviantART
^http://th[^/]+\.deviantart\.net/fs[0-9]+/150/   i   /150/   i   /

// Flickr.com
^http://[^/]+\.staticflickr\.com/.*_[a-z]\.jpg   i   _[a-z]\.jpg   i   _b.jpg

// FOTOLOG
^http://[^/]+\.fotolog\.com/photo/.*_.\.jpg   i   _.\.jpg   i   _f.jpg

// Google Images search engine
// filter the redundant thumbnails that cannot be expanded
^http://.+\.gstatic\.com/images\?q=tbn:.+   i   http://.+\.gstatic\.com/images\?q=tbn:.+   i   NULL
^data:image/jpeg;base64,   i   data:image/jpeg;base64,.+   i   NULL
// 2 rules for one image
^http://www\.google\.[a-z]+/imgres?.*&imgrefurl=.*&imgurl=.+   i   http://www\.google\.[a-z]+/imgres?.*&imgurl=([^&]+)&.*   i   $1   decode
// if there is a %, decode again
^http://www\.google\.[a-z]+/imgres?.*&imgrefurl=.*&imgurl=.+   i   %   i   %   decode

// ImageShack
^http://[^/]+\.imageshack\.us/   i   res=crop   i   res=landing

// imgur Gallery
^http://i\.imgur\.com/.*b\.jpg   i   b\.jpg   i   .jpg

// Picasa Web Albums
^http://[^/]+\.ggpht\.com/.*/s\d{1,3}[^/]*/[^/]*   i   /s\d{1,3}[^/]*/   i   /s2048/

// photobucket albums
^http://[^/]+\.photobucket\.com/albums/.*/th_[^/]+   i   /th_([^/]+)   i   /$1

// Pinterest
^http://[^/]*\.pinterest\.com/upload/.*_[a-z]\.jpg   i   _[a-z]\.jpg   i   .jpg

// Webshots
^http://thumb[^/]+\.webshots.[a-z]+/.*_th\.jpg   i   _th\.jpg   i   _ph.jpg

 

5 comments:

Anonymous said...

// IMDb.com original size
^http://ia.media-imdb.com/images/.*\._V1\._CR[0-9,]+_SS100_\.jpg i \._V1\._CR[0-9,]+_SS100_\. i .
// IMDb.com 1280x1024 maximum
^http://ia.media-imdb.com/images/.*\._V1\._CR[0-9,]+_SS100_\.jpg i \._V1\._CR[0-9,]+_SS100_\. i ._V1._SX1280_SY1024_.

Anonymous said...

How do i write a code for images on imagebam.com? I have tried the instructions but have not been successful?

Anonymous said...

Can you write a code for imagebam.com?
I have tried but no luck. thanks

Anonymous said...

http://idlebrain.com/movie/photogallery/tamanna32/

please do it here.

Anonymous said...

bing images ????

 
Get This <