-
- 4,213 Posts
If you want the pictures to come from a maxigallery gallery, I guess it would be best to link to them by your self in the source and add lightbox scripts to the page so the bigger versions open in lightbox.
But if you don’t need the pictures to be in some gallery, I think it would be best to use a snippet from these forums that uses phpThumb and lightbox v2 to achieve this. Do a search for it, I think it hasn’t been uploaded to the resource repository.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
-
- 4,213 Posts
Quote from: gfroyle at Nov 21, 2006, 11:07 AM
Suppose I have created a gallery with some pictures in it... when you say "link to them by yourself" what exactly should I put in the link?
Just check that what the link to the image is and put it to your document source manually, like:
<a href="assets/galleries/69/somepicture.jpg" rel="lightbox"><img src="tn_somepicture.jpg" /></a>
Quote from: gfroyle at Nov 21, 2006, 11:07 AM
Secondly, when you say "add lightbox scripts to the page" then what does this mean - how do you "add a script to a page"?
Do a snippet that does:
$language = isset($language) ? $language : "en";
$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_'.$language.'.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);
Then call it on the document using [[YourSnippetName? &language=`fr`]] (that language parameter is optional, default is english, language files have to be in maxigallery). Or if you want slimbox to be used to show the "lightbox", look for the code from maxigallery class file regClientScripts function.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
-
- 4,213 Posts
It just uses the pictures from maxigallery and that
ligthbox v2 javascript code to display them.
The snippet code above includes those lightbox v2 javascript files from maxigallery directory to your document source.
The link is just a normal link, the thumbnail image from maxigallery is linked to the bigger image. What does the magic is the rel="lightbox" attribute in the link. When your page loads, that lightbox javascript gets fired up and it looks for all links in the html source to see if they have a rel="lightbox" attribute. If they do, it will attach an onclick listener to the link and when you click it, it will open the linked image in that fancy animated div container. That’s about it in general, nothing special..
"He can have a lollipop any time he wants to. That's what it means to be a programmer."