We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13825
    • 55 Posts
    I’m using the 0.5Beta version of MaxiGallery...

    How can I make sure that auto generated thumbs have a height of 78px and whatever width necessary to keep the aspect ratio. (This goes for main images too actually)

    You can specify max_pic_size and max_thumb_size but a landscape image comes out at a different height to a portrait because the max value as been applied to the greater dimension (width).

    Any way round this anyone?

    Cheers,
    James
      • 1511
      • 144 Posts
      In file /snippets/maxigallery/maxigallery.class.inc.php go to line 221 and find the following code:
      		if($resize){
      			$thumb->size_auto($max_thumb_size);
      		}

      Replace it with
      		if($resize){
      			$thumb->size_height($max_thumb_size);
      		}


      Set the thumb height with max_thumb_size parameter, pic height with max_pic_size and bigpic height with max_big_height.

      Now all the images will be high the specified pixels and the aspect ratio will be unchanged, which means pictures will have different widths but always the exact height.
        • 13825
        • 55 Posts
        Thanks, that’s fantastic...

        Next thumb problem is that I want to link to a gallery and also go to the first image. (i.e. not ’index’ page with just the thumbs).

        I’m new to Modx and Maxigallery but from what I read up I need MaxiGallerySolo to just display a thumb nail image from a gallery is that correct?

        If I want to then show the thumbs on the same page as the full image how can I do that...just dumping the template code in the space beneath the image in the picturetpl file doesn’t work.
        any ideas anyone?

        oh...lastly, if when I’m using MaxiGallerySolo to pull out the image can I also pull out content from the document a gallery is associated with.

        Sorry for the many question...just getting started with this cms and it’s great - just a steep learning curve smiley
          • 7923
          • 4,213 Posts
          Quote from: jdelight at Jan 05, 2007, 02:58 AM

          Next thumb problem is that I want to link to a gallery and also go to the first image. (i.e. not ’index’ page with just the thumbs).
          I didn’t fully understand that what you want to list as the links? Thumbs from certain galleries and then when user clicks, it would open the picture itself straigth away? MaxiGallerySolo has that ability.. there is a parameter called "open" what you can use to define how you want to open the picture and use gallery_browser as the value..

          Quote from: jdelight at Jan 05, 2007, 02:58 AM

          If I want to then show the thumbs on the same page as the full image how can I do that...just dumping the template code in the space beneath the image in the picturetpl file doesn’t work.
          any ideas anyone?

          Currently, the snippet can’t do this by itself.. not sure if this will work, but you could try to do another snippet with this content:
          <?php
          $output ="";
          if ($_REQUEST['pic']) {
              $output = $modx->runSnippet("MaxiGallerySolo", array("galIDs" => $_REQUEST['gal_id'], "open" => "gallery_browser"));
          }
          return $output;
          ?>
          

          and put it below your MaxiGallery snippet call..

          Then create a new snippet with name "MaxiGallerySolo" and use this content:
          //<?//////////////////////////////////////////////////////////////////////////////////////////
          // MaxiGallerySolo by XriS (modified by doze) v.1.1.1b (to be used with maxigallery v0.5 betas)
          // -------------------------------------------------------------------------------------------
          // 
          // This snippet gets the latest or random pictures from selected galleries
          //
          // Call like [!MaxiGallerySolo? &galIDs=`23,51,61` &pics_to_show=`5` &type=`random` &open=`gallery_browser`!]
          //
          // Parameters:
          // &galIDs			= Comma delimitted IDs of the documents that has [MaxiGallery] calls
          // &pics_to_show		= [ number ] : How many pics to show. Default: 1
          // &type			= [ "random" | "latest" ] : Show random pics or latest pics? Default: "latest"
          // &open			= [ "lightbox" | "gallery_browser" | "gallery_overview" ] : When clicking the link, should it open in lightbox, 
          //					gallery browser or should it open the gallery overview where that picture is. Default: "lightbox"
          // &language                    = [ "en" | "fr" | etc.. ] : Lightboxv2 language (you have to have the language files in maxigallery ligthboxv2 folder. Defaul: "en"
          
          if(!function_exists(MGSoloRegClientScripts)) {
          
          	function MGSoloRegClientScripts($language){
          		global $modx;
          		//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_'.$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);
          	}
          }
          
          $returnstring="";
          if(isset($galIDs)){
          	$pics_to_show = isset($pics_to_show) ? $pics_to_show - 1 : "all";
          	$type = isset($type) ? $type : "latest";
          	$open = isset($open) ? $open : "lightbox";
          	$language = isset($language) ? $language : "en";
          	$galIDs = str_replace(",", "','", $galIDs);
          	$pics=$modx->getIntTableRows("*","maxigallery", "gal_id IN ('" . $galIDs . "')","pos,date","DESC");
          	$i=0;
          	if($type == "random"){
          		shuffle($pics);
          	}
          	if ($pics_to_show =="all" || $open=="lightbox") {
          		$forcount = count($pics);
          	}else{
          		$forcount = $pics_to_show+1;
          	}
          	for($i = 0; $i < $forcount; $i++) {
          		$pic = $pics[$i];
          		$path_to_gal = "assets/galleries/".$pic['gal_id']."/";
          		$file = $modx->config['site_url'] . $path_to_gal . $pic['filename'];
          		$tn_file = $modx->config['site_url'] . $path_to_gal . "tn_" . $pic['filename'];
          		if($open=="lightbox"){
          			$returnstring .= "<a href=\"$file\" rel=\"lightbox[maxigallery]\" title=\"<b>".htmlentities(stripslashes($pic['title']))."</b><br />".htmlentities(stripslashes($pic['descr']))."\">";
          		}else if($open=="gallery_browser"){
          			$returnstring .= "<a href=\"".$modx->makeUrl($pic['gal_id'], '', "&pic=".$pic['id'])."\">";
          		}else{
          			$returnstring .= "<a href=\"".$modx->makeUrl($pic['gal_id'], '', '')."\">";
          		}
          		$returnstring .= ($i > $pics_to_show ? "" : "<img src=\"$tn_file\" class=\"thumbnail\">" ) . "</a>";
          	}
          	if($open=="lightbox"){
          		MGSoloRegClientScripts($language);
          	}
          }
          return $returnstring;
          

          Quote from: jdelight at Jan 05, 2007, 02:58 AM

          oh...lastly, if when I’m using MaxiGallerySolo to pull out the image can I also pull out content from the document a gallery is associated with.
          Unfortunately no.. The next version of maxigallery will have the maxigallerysolo features in it, just in a enhanced way and the output will be totally templateable.. and you will be possible to access the target gallery document data.


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 13825
            • 55 Posts
            That sounds great,

            In the mean time I’ve manged to get it working using:
            [!MaxiGallerySolo? &galIDs=`[*id*]` &class=`tmb` &pics_to_show=`[+maxigallery.total_pics_count+]` &type=`latest` &open=`gallery_browser` !]

            within picturetpl.html at the bottom.


            Thanks for you help
              • 7923
              • 4,213 Posts
              Oh yea, forgot that you can just put the maxigallerysolo in to the picturetpl... lol.. good job! That’s the first gallery page that I’ve seen where user have modified the default layouts, very nice. Hope to see more different looking galleries in future!


                "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                • 15451
                • 87 Posts
                i just found this post from about a year ago. i’d like to do the same thing (have a fixed height for the thumbnails so that regardless of if theyre landscape or portrait they all sit in a nice neat line. i’ve checked out line 221 of the file mentioned only seems to have changed since then. i tried replacing what’s in there with the code the fellow suggested, only it didn’t work for me (blank screen when i published it). could anybody tell me where to look/what to do? thanks a lot smiley
                  • 7923
                  • 4,213 Posts


                    "He can have a lollipop any time he wants to. That's what it means to be a programmer."