We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34162
    • 1 Posts
    This is an auto-generated topic for <a href="http://modxcms.com/extras/package/619">Easy 2 Gallery 1.4.0-Beta 4</a> by goldsky.

    Brief Description:
    Features of module:

    1. Creation and editing of folders with unlimited nesting capabilities
    2. Image or zip package uploading via POST method.
    3. Synchronisation of gallery with files and folders uploaded via FTP.
    4. Editing of image info
    5. Comments moderation.

    Snippet features:
    1. Image viewing.
    2. Comments viewing and adding
    3. High customisation capabilities with templates and placeholders.
    4. Breadcrumbs
    5. Pagination
    6. Integrated javascript display modes: colorbox, highslide, fancybox, floatbox,shadowbox,slimbox and lightwindow
    7. Possible to display random image or single image
    8. Possible to sort pictures and folders
    9. Slideshows:
    - Simple
    - Galleriffic
    - SmoothGallery
    - GalleryView
    - ContentFlow

    Wiki:
    http://wiki.modxcms.com/index.php/Easy2gallery
      • 11055 ☆ A M B ☆
      • 3,112 Posts
      For 1.4.0 Beta 3 users, please update this.
      There are minor bugs but annoying in grid system.
      For samples, you can see http://arslantic.co.id/evo/

      UPDATES

      bug fix on the config’s default value overwritten:
      index.php, line 60:
      <?php highlighting
      //if ($valconf[$dk]=='') {
      if ( !isset($valconf[$dk]) && $dk!='captcha') {
      


      please debug the index.php line 49 (of E2G 1.4.0 beta 4) like this:
      <?php // highlighting
      
      if (file_exists( E2G_MODULE_PATH . 'config.easy2gallery.php' )) {
          require E2G_MODULE_PATH . 'config.easy2gallery.php';
          foreach ($e2g as $ck => $cv) {
              $keyconf[$ck] = $ck;
              $valconf[$ck] = $cv;
          }
      }
      // the default config will replace blank value of config's.
      if (file_exists( E2G_MODULE_PATH . 'default.config.easy2gallery.php' )) {
          require E2G_MODULE_PATH . 'default.config.easy2gallery.php';
          foreach ($def_e2g as $dk => $dv) {
              if ($valconf[$dk]=='') {
                  $e2g[$dk] = $dv;
              }
          }
          $def_e2g = array();
          unset($def_e2g);
      }
      


      to be:
      <?php // highlighting
      // CONFIGURATIONS
      if (!file_exists(E2G_MODULE_PATH . 'config.easy2gallery.php')) {
          // if config file has not been created, yet, this will create one
          $createconfig = fopen(E2G_MODULE_PATH . 'config.easy2gallery.php', 'w+');
      } else {
          require_once E2G_MODULE_PATH . 'config.easy2gallery.php';
          foreach ($e2g as $ck => $cv) {
              $confkey[$ck] = $ck;
              $confval[$ck] = $cv;
          }
      }
      
      // the default config will replace any blank value of config's.
      if (file_exists( E2G_MODULE_PATH . 'default.config.easy2gallery.php' )) {
          require_once E2G_MODULE_PATH . 'default.config.easy2gallery.php';
          // if config file is missing, this will create one
          if (isset($createconfig)) {
              $c = "<?php\r\n\$e2g = array (\r\n";
              foreach($def_e2g as $dk => $dv) {
                  $c .= "        '$dk' => ".(is_numeric($dv)?$dv:"'".addslashes($dv)."'").",\r\n";
              }
              $c .= ");\r\n?>";
              fwrite($createconfig, $c);
              fclose($createconfig);
              unset($createconfig);
          }
      
          foreach ($def_e2g as $dk => $dv) {
              if ( !isset($confkey[$dk]) && $dk!='captcha') {
                  $e2g[$dk] = $dv;
              }
          }
          $def_e2g = array();
          unset($def_e2g);
      }
      


      Open config.libs.easy2gallery.php
      At the top part, change this
      <?php //highlighting
      //$gid = (!empty($_GET['gid']) && is_numeric($_GET['gid'])) ? (int) $_GET['gid'] : ( !empty($gid) ? $gid : 1 );
      $gid = $this->cl_cfg['gid'];
      //$show_group = isset($show_group) ? $show_group : 'Gallery'.$gid;
      $show_group = $this->cl_cfg['show_group'];
      


      e2g.snippet.class.php, line 69
      <?php // highlighting
              //$cat_name_len = $this->cl_cfg['cat_name_len'];
              $mbstring = $this->cl_cfg[['mbstring'];
              $title_len = $this->cl_cfg['cat_name_len'];
      


      change in e2g.module.class.php at line around 449 from:
      <?php
      foreach($_POST as $k => $v) {
          $c .= "'$k' => ".(is_numeric($v)?$v:"'$v'").",\r\n";
      }
      

      to be
      <?php
      foreach($_POST as $k => $v) {
          $c .= "'$k' => ".(is_numeric($v)?$v:"'".addslashes($v)."'").",\r\n";
      }
      


      show.easy2gallery.php
      <?php // highligthing
      
          ob_start();
          header('Last-Modified: '.date('r'));
          header('Accept-Ranges: bytes');
      //    header('Content-Length: '.$filesize2sent);
          header('Content-type: image/jpeg');
          header('Content-Disposition: inline; filename="'.$filename2send.'"');
          imagejpeg($im);
          header('Content-Length: ' . ob_get_length()); // try this
          ob_end_flush();
          imagedestroy($im);
      
      } else {
          header('Content-type: image/jpeg');
          header('Location: '.$fp);
          //readfile ('../../../'.$e2g['dir'].$path.$row['id'].$ext);
          exit();
      }
      
        Rico
        Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
        MODx is great, but knowing how to use it well makes it perfect!

        www.virtudraft.com

        Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

        Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

        Maintainter/contributor of Babel

        Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
        • 6848
        • 52 Posts
        Hi,
        See my post http://modxcms.com/forums/index.php/topic,48314.msg288104.html#msg288104

        May be this is valid for beta4 as well (didn’t have time to test it yet.
          • 11055 ☆ A M B ☆
          • 3,112 Posts
          Awesome!
          I’ve never realized this part.

          Thx for pointing this out!
            Rico
            Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
            MODx is great, but knowing how to use it well makes it perfect!

            www.virtudraft.com

            Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

            Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

            Maintainter/contributor of Babel

            Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
            • 11055 ☆ A M B ☆
            • 3,112 Posts
            hmm...

            The problem seems comes from the Content-Length.
            If I disable that (only!), it goes fast, and right (not chopped off).

            So I guess (haven’t tested this on my live site) the solution is only like this:
            <?php // highligthing
            
                ob_start();
                header('Last-Modified: '.date('r'));
                header('Accept-Ranges: bytes');
            //    header('Content-Length: '.$filesize2sent);
                header('Content-type: image/jpeg');
                header('Content-Disposition: inline; filename="'.$filename2send.'"');
                imagejpeg($im);
                header('Content-Length: ' . ob_get_length()); // try this
                ob_end_flush();
                imagedestroy($im);
            
            } else {
                header('Content-type: image/jpeg');
                header('Location: '.$fp);
                //readfile ('../../../'.$e2g['dir'].$path.$row['id'].$ext);
                exit();
            }
            
              Rico
              Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
              MODx is great, but knowing how to use it well makes it perfect!

              www.virtudraft.com

              Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

              Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

              Maintainter/contributor of Babel

              Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
              • 10257
              • 55 Posts
              At least in beta3 there is a problem, when you use "’" in the Watermark text. It breaks the config.easy2gallery.php.

              You can input it as "\’", to make it work. But after visiting options again, it is displayed as "’" so to break all again when saving.
                • 11055 ☆ A M B ☆
                • 3,112 Posts
                Quote from: fthieme at May 14, 2010, 04:58 PM

                At least in beta3 there is a problem, when you use "’" in the Watermark text. It breaks the config.easy2gallery.php.

                You can input it as "\’", to make it work. But after visiting options again, it is displayed as "’" so to break all again when saving.

                Thanks for reporting.
                You can make the change in e2g.module.class.php at line around 449 from:
                <?php
                foreach($_POST as $k => $v) {
                    $c .= "'$k' => ".(is_numeric($v)?$v:"'$v'").",\r\n";
                }
                

                to be
                <?php
                foreach($_POST as $k => $v) {
                    $c .= "'$k' => ".(is_numeric($v)?$v:"'".addslashes($v)."'").",\r\n";
                }
                
                  Rico
                  Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                  MODx is great, but knowing how to use it well makes it perfect!

                  www.virtudraft.com

                  Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                  Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                  Maintainter/contributor of Babel

                  Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
                  • 10257
                  • 55 Posts
                  I will try that.

                  BTW: ever tried " characters in description field for pictures? Haven’t tried in beta4, yet, but in beta3 it breaks the description.

                  With beta4 some options that are saved in config.easy2gallery.php are not visible in the config section. So I disabled debug and comments but they are set to "on" in config section. They are indeed disabled in the .php file...

                  Another thought on usability/security:

                  • It should not be possible to go out of the subtree specified in the gid value of the easy2 statement.
                  • breadcrumb navigation shouldn’t start on root but on gid given in easy2 statement.
                  • Should be possible to give IDs to an easy2 call like in Ditto, to have more than one gallery at the page.

                  What do I mean?
                  Right now it is possible to go to any site with an easy2 tag, add &gid=number to its URL and get any gallery that is available by knowing - or guessing - the number. It should not be possible to change that number to anything outside of the subtree of the original easy2 call of that page.

                  As it is not possible to go outside that subtree, you shouldn’t even mention, that there is a tree upwards of that point.

                  Some good news at the end - I really love the possibilities of fid - its great if you just want to stand out some of the pictures in an gallery.
                    • 11055 ☆ A M B ☆
                    • 3,112 Posts
                    Quote from: fthieme at May 15, 2010, 09:50 AM

                    I will try that.

                    BTW: ever tried " characters in description field for pictures? Haven’t tried in beta4, yet, but in beta3 it breaks the description.
                    Got it. Has been fixed. I will upload the update.

                    Quote from: fthieme at May 15, 2010, 09:50 AM

                    With beta4 some options that are saved in config.easy2gallery.php are not visible in the config section. So I disabled debug and comments but they are set to "on" in config section. They are indeed disabled in the .php file...
                    I resurrected the $debug parameter, which unfortunately conflicted with MODx’s $debug parameter. Update will be uploaded.

                    Quote from: fthieme at May 15, 2010, 09:50 AM

                    Another thought on usability/security:

                    • It should not be possible to go out of the subtree specified in the gid value of the easy2 statement.
                    • breadcrumb navigation shouldn’t start on root but on gid given in easy2 statement.
                    • Should be possible to give IDs to an easy2 call like in Ditto, to have more than one gallery at the page.
                    1. ... read comment more below ...
                    2. Uhm... You’re right. Never thought about this. Sound logic to me.
                    If nobody mind this, I’ll adopt this.
                    3. try &gid=`2,3,4,5` .it should work on E2G 1.4.0
                    Quote from: fthieme at May 15, 2010, 09:50 AM

                    What do I mean?
                    Right now it is possible to go to any site with an easy2 tag, add &gid=number to its URL and get any gallery that is available by knowing - or guessing - the number. It should not be possible to change that number to anything outside of the subtree of the original easy2 call of that page.
                    I’ve never thought about security measurement for the snippet part, since everything should be public. If you’re mentioning about image’s access, we’ll talk later about storing the images into database rather as file system.

                    Quote from: fthieme at May 15, 2010, 09:50 AM

                    Some good news at the end - I really love the possibilities of fid - its great if you just want to stand out some of the pictures in an gallery.
                    You’d love slideshows on Beta 4 smiley
                    &gid+&fid+&rgid are still applied.
                      Rico
                      Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                      MODx is great, but knowing how to use it well makes it perfect!

                      www.virtudraft.com

                      Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                      Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                      Maintainter/contributor of Babel

                      Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
                      • 10257
                      • 55 Posts
                      Quote from: goldsky at May 16, 2010, 02:20 AM

                      Quote from: fthieme at May 15, 2010, 09:50 AM

                      Should be possible to give IDs to an easy2 call like in Ditto, to have more than one gallery at the page.
                      try &gid=`2,3,4,5` .it should work on E2G 1.4.0

                      Yeah, that gives one big gallery with all the content of galleries 2,3,4,5, but that was not my use case wink

                      I adopt a little page about dogs and puppies to modx [1]. Now there are sub galleries for each week and below the weeks subgalleries for different puppies. Now I had a page where I talked about the different dogs and to make it easy I put the pictures below each dog as a gid call. At the end of the page I said here is the weeks gallery complete with another gid call.

                      Now when someone changes into a subgallery of that last call, all gid calls use exactly the gid parameter from the url. So you have - in my case - three times the gallery on different positions of the page. This wouldn’t happen, if easy2 would not go outside the specified subtree.

                      As there where only a handful pictures in each puppy gallery I solved this by using fid instead of gid, but you loose flexibility there...

                      [1] http://modx.fthieme.net/welpen/j-wurf/fuenf-wochen.html