<?php
////////////////////////////////////////////////////
// GrabMGImage
// Made by Dimmy, modified by andrazk, modifed again by Dimmy (galid not needed anymore)
// grabs a image from Maxigallery by using the image id
// use like this [!GrabMGImage?&id=`5`&align=`left`!]
//
// optional options are &thumb wil display the thumb version &imgtag will generate an imgtag,
// align parameter will align the img
// when both are set to 1 you wil get a thumb with a lik to the normal image including lightbox tags
// when thumb is set to 1 and imgtag to 0 it wil display the thumb without as link
// when both are set to 0 it wil only give the image path
// when thumb is set to 0 and imgtag to 1 it wil display the normal image.
// when both are not use at all it wil display the normal image.
/////
$thumb = isset($thumb)?$thumb:1;
$imgtag = isset($imgtag)?$imgtag:1;
$align = isset($align)?$align:'';
$id = isset($id)? $id : 1;
$result = $modx->db->select("*", $modx->getFullTableName('maxigallery')," id='".$id."'");
$info = $modx->db->getRow($result);
$folder="assets/galleries/".$info['gal_id']."/";
$title = trim($info['title']);
$imagename=$info['filename'];
$description = trim($info['descr']);
if($thumb == 1) {
$filename= "tn_".$imagename;
}else{
$filename= $imagename;
}
//lightbox scripts
$lightboxv2_css_link = '<link rel="stylesheet" href="' . $modx->config['base_url'] . 'assets/snippets/maxigallery/lightboxv2/css/lightbox.css" type="text/css" media="screen" />';
$lightboxv2_script_link1 = $modx->config['base_url'] . 'assets/snippets/maxigallery/lightboxv2/js/lightbox_setup.js';
$lightboxv2_settings = 'assets/snippets/maxigallery/lightboxv2/js/lightbox_lang_'.$this->mgconfig['lang'].'.js';
if(file_exists($modx->config['base_path'].$lightboxv2_settings)){
$lightboxv2_script_link2 = $modx->config['base_url'] . $lightboxv2_settings;
}else{
$lightboxv2_script_link2 = $modx->config['base_url'] . 'assets/snippets/maxigallery/lightboxv2/js/lightbox_lang_en.js';
}
$lightboxv2_script_link3 = $modx->config['base_url'] . 'assets/snippets/maxigallery/lightboxv2/js/prototype.js';
$lightboxv2_script_link4 = $modx->config['base_url'] . 'assets/snippets/maxigallery/lightboxv2/js/scriptaculous.js?load=effects';
$lightboxv2_script_link5 = $modx->config['base_url'] . 'assets/snippets/maxigallery/lightboxv2/js/lightbox.js';
$modx->regClientCSS($lightboxv2_css_link);
$modx->regClientStartupScript($lightboxv2_script_link1);
$modx->regClientStartupScript($lightboxv2_script_link2);
$modx->regClientStartupScript($lightboxv2_script_link3);
$modx->regClientStartupScript($lightboxv2_script_link4);
$modx->regClientStartupScript($lightboxv2_script_link5);
$al = $align == '' ? $align : 'align="'.$align.'"';
if(($thumb == 1)&&($imgtag==1)) {
$output="<a href='[(site_url)]".$folder.$info['filename']."' rel='lightbox[maxigallery]' title='".$description."'><img ".$al." src='".$folder.$filename."' title='".$description."' alt='".$description."' class='thumbnail' /></a>";
}
if(($thumb == 0)&&($imgtag==1)) {
$output="<img ".$al." src='".$folder.$filename."' title='".$description."' alt='".$description."' />";
}
if(($thumb == 0)&&($imgtag==0)) {
$output=$folder.$filename;
}
if(($thumb == 1)&&($imgtag==0)) {
$output="<img ".$al." src='".$folder.$filename."' title='".$description."' alt='".$description."' class='thumbnail' /></a>";
}
return $output;
?>
$output="<a href='[(site_url)]".$folder.$info['filename']."' rel='lightbox[maxigallery]' title='".$description."'><img ".$al." src='".$folder.$filename."' title='".$description."' alt='".$description."' class='thumbnail' /></a>";
$output="<a href='[(site_url)]".$folder.$info['filename']."' rel='lightbox_".$folder."/gallery' title='".$description."'><img ".$al." src='".$folder.$filename."' title='".$description."' alt='".$description."' class='thumbnail' /></a>";
// Add next link
if (i < (all_source.length - 1)) {
var next_node = all_source[i+1];
var next_href = next_node.getAttribute("id");
.
.
.
// Add number
var number_elm = node.getElementsByTagName("number");
var number = document.createTextNode
(number_elm[0].firstChild.nodeValue);
objNumber.appendChild(number);
$slidebox_script_link4 = $modx->config['base_url'] . 'assets/snippets/maxigallery/slidebox/slidebox.js';
$slidebox_script_link4 = $modx->config['base_url'] . 'assets/snippets/maxigallery/slidebox/mySlidebox.js';
