We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6841
    • 61 Posts
    I’ve seen this behavior, but I have not pursued a solution yet.
      Dave
      • 33372
      • 1,611 Posts
      Well I have confirmed that sometimes the MaxiGallery CSS and JS links are not being added to the head (and that is what causes images to load in a regular blank window instead of as a lightbox or whatever). So something is going on in the document parser that is producing intermitant glitches. In my case I’m only using one type of gallery presentation on one group of pages, so I found an easy workaround.

      I created a template for these pages only. Then I added the appropriate MaxiGallery head code to that template. And then to keep the snippet from adding it again, I completely commented out all of the code in the regScriptsAndCSS function (which is what adds these normally).

      It’s a hack, but in my case a hack is all I need...
        "Things are not what they appear to be; nor are they otherwise." - Buddha

        "Well, gee, Buddha - that wasn't very helpful..." - ZAP

        Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
        • 33372
        • 1,611 Posts
        Another hack to report... Well, this time it’s a hack in progress, since I expect it will change as I discover bugs and/or other stupidity. But for right now I’m very happy it’s working.

        I wanted to have the first image load automatically into a lightbox when the page loads. So I added an id to the <a> tags in the snippet and called the lightbox script using this ID. I couldn’t get it to work in both IE and Firefox without adding a basic get object function to the lightbox.js, so the end of that file now looks like this:

        function getObject(objectId){
        
        	if(document.getElementById && document.getElementById(objectId)){
        		return document.getElementById(objectId);
        	}
        	else if (document.all && document.all(objectId)){
        		return document.all(objectId);
        	}
        	else if (document.layers && document.layers[objectId]){
        		return document.layers[objectId];
        	}
        	else {
        		return false;
        	}
        }
        
        function initLightbox() { myLightbox = new Lightbox();var startImg=getObject('img0');if(startImg){myLightbox.start(startImg);return false;} }
        Event.observe(window, 'load', initLightbox, false);


        Then in the MaxiGallery snippet I added the ID tags to lightbox images (around line 1396), like so:
        				$link="<a id=\"img".$i."\" href=\"[(site_url)]" . $file . "\" rel=\"lightbox[maxigallery]\" title=\"<b>".htmlentities(stripslashes($pic['title']),ENT_NOQUOTES,$mgconfig['use_charset'])."</b><br />".htmlentities(stripslashes($pic['descr']),ENT_NOQUOTES,$mgconfig['use_charset'])."\">";
        


        This always calls the first gallery image found on the page and presents it when the page finishes loading, assuming you’re viewing them in a lightgallery (if not it shouldn’t affect anything at all). If you want to randomize the order of the pics displayed in the gallery, just add shuffle($pics); beneath the query that defines the $pics array. In my case there are only zero to 3 images per page, so randomizing just makes the pop-up lightbox a little more interesting.

        I have only tested this on IE6 and Firefox 1.5 on Windows, but that’s a good start...
          "Things are not what they appear to be; nor are they otherwise." - Buddha

          "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

          Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
          • 24166
          • 11 Posts
          « MODx Parse Error »
          MODx encountered the following error while attempting to parse the requested resource:
          « PHP Parse Error »

          PHP error debug
          Error: imagecreatetruecolor(): Invalid image dimensions
          Error type/ Nr.: Warning - 2
          File: /home/<...>/assets/snippets/maxigallery/watermark/Thumbnail.class.php
          Line: 354
          Line 354 source: $this->img["des"] = ImageCreateTrueColor($X_des,$Y_des);

          Parser timing
          MySQL: 0.5605 s s (3 Requests)
          PHP: 0.4602 s s
          Total: 1.0207 s s
          what does it mean?

          PS: sorry for my english =)
            • 33372
            • 1,611 Posts
            It looks as if you have not set the proper location for your watermark image (or it’s not there).
              "Things are not what they appear to be; nor are they otherwise." - Buddha

              "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

              Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
              • 727
              • 502 Posts
              I followed the installation instructions to the letter. I’m running MODx 0.9.2.1. I inserted on a non-cached page:

              [[MaxiGallery?&pics_in_a_row=`3`&max_thumb_size=`110`&max_pic_size=`400`&titles_in_overview=`1`&keep_bigimg=`1`&pics_per_page=`6`]]
              


              and I get:

              Parse error: parse error, unexpected $ in /home/andy/public_html/beverleyinpictures/manager/includes/document.parser.class.inc.php(705) : eval()'d code on line 743
              


              I didn’t have any problems originally installing MODx. I cut and pasted the snippet code twice. Any ideas?

              Andy
                • 21595
                • 159 Posts
                did you published your page before inerting photos?
                  • 7923
                  • 4,213 Posts
                  Been gone few days and lots of things has happened! laugh

                  Nice work ZAP! That will denitely help someone wanting to do the same thing sometime.

                  About the issue that you are having with the css/js scripts (that they are not allways loaded to the head of the template), I think you should add it to modx bugtracker so we can get it resolved..

                  Can you ddecjc check that are you having the same problem? That the scripts are not allways at the template head?

                  And just to be clear, by saying that you guys are having "blank page" do you mean that the picture opens in a blank page or that modx returns a blank page when browsing galleries for example? I’ve seen that you ZAP have battled against the latter problem too.. smiley

                  ajayre, try to put spaces between the parameters in the snippet call


                    "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                    • 727
                    • 502 Posts
                    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.

                    Andy
                      • 33372
                      • 1,611 Posts
                      Quote from: ajayre at May 07, 2006, 12:01 PM

                      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.
                      Hmm... 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?

                      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?
                        "Things are not what they appear to be; nor are they otherwise." - Buddha

                        "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                        Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options

                      This discussion is closed to further replies. Keep calm and carry on.