Quote from: ajayre at May 07, 2006, 12:01 PMHmm... I know you said you cut and pasted the snippet twice already, but that just sounds like an error in the snippet code to me. Maybe a third time?
I added spaces before and after the ampersands - didn’t help. I have the page published, but I don’t have any photos added because I can’t run the snippet.
That PHP error seems like you are missing a ; or a } in the line(s) immediately above where the error shows up. I’ve had it when I’ve commented out parts of a script and then realized that I’d put /* at the end as well as at the beginning. Did you make any changes to the snippet at all?
And just to confirm: You are running the latest MODx, right?
////////////////////////////////////////////////////////////////////////////////////////////
// MaxiGalleryTour - a scripted version of
// MaxiGallerySolo by XriS (modified by doze)
// hacked together by ZAP
// ------------------------------------------
//
// This snippet gets the latest or random pictures from a group of galleries
// and displays them as a slideshow automatically when the page loads.
//
// This ONLY works with the Lightshow v2 display method and only after modifying lightshow.js to auto-launch
//
// Example call: [!MaxiGalleryTour? &galIDs=`9,10,11,12,13,14,15` &link_text=`Click here to launch slideshow` &type=`random`!]
//
// Parameters:
// &galIDs = Comma delimitted IDs of documents with [MaxiGallery] snippets and associated galleries
// &link_text = Text in order to lauch the slideshow manually (leave blank for no manual launch link)
// &type = [ "random" | "latest" ] : Show random pics or latest pics? Defaults to "random"
//
// Or you can set the parameters here in the snippet if you don't need to vary them, like so:
$galIDs = '9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40'; //set all gallery IDs here
$link_text = 'Click here to launch slideshow';
function regClientScripts(){
global $modx;
//lightbox scripts
$lightboxv2_css_link = '<link rel="stylesheet" href="' . $modx->config['site_url'] . 'assets/snippets/maxigallery/lightboxv2/css/lightbox.css" type="text/css" media="screen" />';
$lightboxv2_script_link1 = $modx->config['site_url'] . 'assets/snippets/maxigallery/lightboxv2/js/prototype.js';
$lightboxv2_script_link2 = $modx->config['site_url'] . 'assets/snippets/maxigallery/lightboxv2/js/scriptaculous.js?load=effects';
$lightboxv2_script_link3 = $modx->config['site_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);
}
$output='';
if(isset($galIDs)){
$type = isset($type) ? $type : "random";
$galIDs = str_replace(",", "','", $galIDs);
$pics=$modx->getIntTableRows("*","maxigallery", "gal_id IN ('" . $galIDs . "')","pos,title","ASC");
$i=0;
if($type == "random") shuffle($pics);
for($i = 0; $i < count($pics); $i++) {
$pic = $pics[$i];
$path_to_gal = 'assets/galleries/'.$pic['gal_id'].'/';
$file = $modx->config['site_url'] . $path_to_gal . $pic['filename'];
$output .= "\n".'<a id="img'.$i.'" href="'.$file.'" rel="lightbox[maxigallery]" title="'.htmlentities(stripslashes($pic['title'])).' - '.htmlentities(stripslashes($pic['descr'])).'">';
$output .= ($i == 0 ? $link_text : '').'</a>';
}
// I have commented the line below until the function works reliably:
// regClientScripts();
// It should add the lightbox JS and CSS to the document head
// but a bug in the document parser is causing it to sometimes not add this code
// For now I have just added the lightbox JS and CSS code to the head of a template file
// Later when this bug has been addressed you can use this function instead if you like
// The lines to add to your head in the meantime are:
/*
<link rel="stylesheet" href="http://www.yourdomainname.com/assets/snippets/maxigallery/lightboxv2/css/lightbox.css" type="text/css" media="screen" />
<script type='text/javascript' language='JavaScript' src='http://www.yourdomainname.com/assets/snippets/maxigallery/lightboxv2/js/prototype.js'></script>
<script type='text/javascript' language='JavaScript' src='http://www.yourdomainname.com/assets/snippets/maxigallery/lightboxv2/js/scriptaculous.js?load=effects'></script>
<script type='text/javascript' language='JavaScript' src='http://www.yourdomainname.com/assets/snippets/maxigallery/lightboxv2/js/lightbox.js'></script>
*/
}
return $output;
That’s weird. I use exactly the same version of MODx and PHP on the same two browsers and I’ve never had that happen. What you describe does sound like like some sort of weird form posting error in MODx.
Anyway the important thing is that you figured it out and got it working.
That class in watermark folder is used to create all thumbnails, with or without watermarks. It seems that you don’t have GD library installed on your webserver or the GD library is too old. It has to be versio 1.8 or later.
You can check what version you have by looking at the phpinfo() at modx manager. Go to administration > view system info and click view at the phpinfo block.
[table][tr][td]GD Support[/td][td]enabled[/td][/tr]
[tr][td]GD Version[/td] [td]bundled (2.0.28 compatible)[/td][/tr]
[tr][td]FreeType Support[/td] [td]enabled[/td][/tr]
[tr][td]FreeType Linkage[/td] [td]with freetype[/td][/tr]
[tr][td]GIF Read Support[/td] [td]enabled[/td][/tr]
[tr][td]GIF Create Support[/td] [td]enabled[/td][/tr]
[tr][td]JPG Support[/td] [td]enabled[/td][/tr]
[tr][td]PNG Support [/td][td]enabled[/td][/tr]
[tr][td]WBMP Support[/td] [td]enabled[/td][/tr]
[tr][td]XBM Support[/td] [td]enabled[/td][/tr][/table]
Quote from: ZAP at May 07, 2006, 04:25 PM
Thanks to debugging steps from Doze I found the problem and solution.
Pasting the snippet code appeared to be ok, however it was actually truncating it when I clicked on Save. Viewing the code again showed it to be truncated.
This happens in IE 6 and FF 1.5, so might be a PHP or MODx problem.
The only solution I could find was to paste the snippet code using phpMyAdmin.
That’s weird. I use exactly the same version of MODx and PHP on the same two browsers and I’ve never had that happen. What you describe does sound like like some sort of weird form posting error in MODx.
$filename = strtr($filename, "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöùúûüýþÿ ", "aaaaaaaceeeeiiiidnooooo0uuuuypsaaaaaaaceeeeiiiionooooouuuuypy_");
So you have GD library enabled ok.. What’s the size of the pic you are trying to upload? What type is it, gif, png, jpg? Are you trying to upload multiple pictures at the same time? Have you tried with different/smaller pics? hmm.. well, answer to those first and I’ll think of more questions to ask
GD Support enabled
GD Version bundled (2.0.28 compatible)
....
I’m trying to upload this picture.
Quote from: qnick at May 08, 2006, 03:49 AMSo you have GD library enabled ok.. What’s the size of the pic you are trying to upload? What type is it, gif, png, jpg? Are you trying to upload multiple pictures at the same time? Have you tried with different/smaller pics? hmm.. well, answer to those first and I’ll think of more questions to ask
GD Support enabled
GD Version bundled (2.0.28 compatible)
....
I’m sorry, but I don’t know what’s going on.. I thought that the pics would be corrupted somehow, because that can cause errors like this.. but they uploaded fine here. Have anyone else had problems like this?
Quote from: doze at May 08, 2006, 04:25 AMI’m trying to upload this picture.
Quote from: qnick at May 08, 2006, 03:49 AMSo you have GD library enabled ok.. What’s the size of the pic you are trying to upload? What type is it, gif, png, jpg? Are you trying to upload multiple pictures at the same time? Have you tried with different/smaller pics? hmm.. well, answer to those first and I’ll think of more questions to ask
GD Support enabled
GD Version bundled (2.0.28 compatible)
....
Yes, I have tried with smaller pic.
This discussion is closed to further replies. Keep calm and carry on.