"WebSnapr lets you capture screenshots of (almost) any web page. Let your visitors to instantly visualize any web page before clicking. Increase site traffic, click-through rate and site stickiness."
http://websnapr.com/

I tried to hack it with urlfilter on 4.7 (which is in the core of new v5)
http://drupal.org/project/urlfilter

normal usage is to replace
http://images.websnapr.com/?url=URL

I tried to hack it to the urlfilter, but click on the link opens new window with the thumb. and no rollover as it suppose to function.

I changed line 72-77

function urlfilter_replace2($match) {
  $match[2] = decode_entities($match[2]);
  $caption = check_plain(urlfilter_trim($match[2]));
  $match[2] = check_plain($match[2]);
  return $match[1] . '<a href="http://'. $match[2] .'" title="'. $match[2] .'">'. $caption .'</a>'. $match[3];
}

with

function urlfilter_replace2($match) {
  $match[2] = decode_entities($match[2]);
  $caption = check_plain(urlfilter_trim($match[2]));
  $match[2] = check_plain($match[2]);
  return $match[1] . '<a href="http://images.websnapr.com/?url='. $match[2] .'" title="'. $match[2] .'">'. $caption .'</a>'. $match[3];
}

its a crap hack and not a proper result, can anyone help to get it right?

thanks

~ and maybe it can be a 'fancy' option in the core with an on/off admin setting?

Comments

ak’s picture

Great service, nice idea wanted this right away and got it to work with weblinks of the links package module. Here's my implementation, must have links pagage and weblinks installed. Download the previewbubble.js at http://websnapr.com/previewbubble/. Add the javascript to your page.tpl.php, mine lives in a folder named scripts in my theme.

<script type="text/javascript" src="<?php print base_path().path_to_theme()?>/scripts/previewbubble.js"></script>

Clone node.tpl.php and create a node-weblink.tpl.php. Replace the title display with the code below. This addresses and covers two issues. Our weblink titles will become a trackable, clickable direct links to the destination site and secondly will show the thumbnails of the link by mouseover through the websnapr.com service.

<?php if ($page == 0) {?>
<h2 class="title">
<?php print l($node->title, 'links/goto/' . $node->nid . '/' . $links_weblink[0]['lid'] .'/links_weblink', 
array(title=>$links_weblink_url,'class'=>'previewlink'))?>
</h2>
<?php print }?>

Note that the original javascript uses the href attribute of your hyperlink. As we don't want our tracking to break we can't use the href attribute because it reads something like this href=/links/goto/415/4/links_weblink. So we must make a small modification to previewbubble.js.

Look for var _d=_c.href; and replace it with var _d=_c.title;

As we stored the url to our destination in the title attribute of our hyperlink we can just use the title rather then the href attribute to send websnapr.com the correct request url. This is a realy great feature to my links directory and works like a charm for me.
Hope you enjoy it as much as I do.