Skip to content

Instantly share code, notes, and snippets.

@thiagosf
Created August 24, 2010 21:32
Show Gist options
  • Save thiagosf/548367 to your computer and use it in GitHub Desktop.
Save thiagosf/548367 to your computer and use it in GitHub Desktop.
Helper para Lightbox
<?php
/**
* Helper para Lightbox
*/
class LightboxHelper extends AppHelper {
var $helpers = array('Html');
function img($thumb, $full, $imgAttributes = array(), $linkAttributes = array()) {
$defaultLinkAttributes = array('rel'=>'lightbox');
$linkAttributes = array_merge($defaultLinkAttributes, $linkAttributes);
$thumb = $this->Html->image($thumb, $imgAttributes);
if (strpos($full, '://') === false) {
$full .= '?r='.rand(0,77777);
$full = $this->Html->webroot(IMAGES_URL . $full);
}
return $this->Html->output(sprintf(
$this->Html->tags['link'], $full, $this->Html->_parseAttributes($linkAttributes), $thumb)
);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment