We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11055 ☆ A M B ☆
    • 3,112 Posts
    bug fix on the config’s default value overwritten:
    index.php, line 60:
    <?php highlighting
    //if ($valconf[$dk]=='') {
    if ( !isset($valconf[$dk]) && $dk!='captcha') {
    

      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.
      • 9757
      • 82 Posts
      I’ve attached Polish lang files for easy2gallery on google code smiley

      And btw. another feature request:
      - hiding tabs/options for some roles so only selected users will be able to edit configuration

      This is absolutely crucial if we want to use easy2gallery in the ’real world’ smiley
        • 11055 ☆ A M B ☆
        • 3,112 Posts
        Guys,
        I’ve already make a successful moving files/folders.
        Another naughty thought, do we really need a ’copy’ function? tongue
          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
          @mgen (and all others),
          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);
          }
          
            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.
            • 18913
            • 654 Posts
            Hi,
            Still working with this and thought I’d make a couple of observations :
            - I’ve got a client who has large images (about 40 or so) and was testing the ContentFlow slideshow. For whatever reason, it looks like the browser is pulling in the full image rather than a resized version? Maybe I’m misunderstanding what it is supposed to do, but this call
            [!easy2? &slideshow=`contentflow` &ss_config=`default` &ss_limit=`99` &ss_css=`assets/modules/easy2/e2g_overrides_test.css`!]

            generates "image" tags, versus the "canvas" tags found under the ContentFlow demo at
            http://arslantic.co.id/evo/contentflow.html

            E.g. I get this
            <img title="010_abc.jpg" src="assets/gallery/010_abc.jpg" class="content landscape" origproportion="NaN">

            versus
            <canvas title="djkt-nyebrang.jpg" src="assets/gallery/djkt-nyebrang.jpg" class="content landscape" origproportion="1.4957264957264957" width="175" height="176"></canvas>


            I haven’t messed with any of the ContentFlow code - is there any suggestion as to what I did wrong? I’m using v1.4.0 Beta 4 from a week or two ago...

            - On the SmoothGallery slideshow, I wanted to place the previous and next arrows outside of the image area. The forum for the original code didn’t have any answers on it, but I accomplished it this way :
            -- edit smoothgallery.php to remove the "!important" parameter of the width height code that is generated.
            -- create an "override" css file and call it as in the above example. My file contained this :
            #myGallery {
            width : 500px;
            border: none;
            }
            
            .jdGallery .slideElement {
            background-color : #e0e0e0;
            }
            
            .jdGallery a.right, .jdGallery  a.left {
            width: 50px;
            }
            
            .jdGallery .slideInfoZone {
            margin:0 0 0 50px;
            width:400px;
            }
            
            .jdGallery a, .jdGallery a:link {
            border-bottom:none;
            }
            

            (I’d like to pull descriptive info into the slideInfoZone, but haven’t figured out how to do that yet).

            There may be better ways to accomplish this, but this seemed to me to be the least intrusive.

            - I got image area tagging to work with the landing page option of Easy2Gallery. There’s some misalignments due to some padding that was taking place in the example I was working on, but I’ll describe it later in case anyone’s interested. The code stores the area tags in it’s own table. I really have no idea how to extend it so that it could be used in creating special searches based on the tags or category listings, etc. But there are brighter minds here than mine and I’m sure they’ll figure it out if the need warrants smiley

            Matt
              • 18913
              • 654 Posts
              Well that was weird. It looks like I was having a conflict by having the QuickManager plugin active (which has it’s own jQuery calls.) Disabling that seems to have fixed issues with ContentFlow. But still checking ...
              Matt
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                As far as I have been able to tell, usually QM is configured to run jQuery in no-conflict mode, which can break other jquery scripts. Either configure QM to not load jQuery in the front-end (you load it yourself in the template head) or configure QM to not use no-conflict mode. Unless I need jQuery for all of my pages, I’ll use a snippet to load jQuery if the visitor is not a manager user, and don’t use no-conflict mode.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 11055 ☆ A M B ☆
                  • 3,112 Posts
                  Don’t use ContentFlow for a serious business.
                  It is buggy, especially when the visitor comes to your website at the first time, by Firefox or Opera.
                  It has been a discussion a while ago on the russian forum.

                  You can visit the contentflow’s website.
                  Then clear your browser’s cache, F5, and you’ll understand what I’m talking about.

                  You can turn off QM’s jQuery from its plugin menu.
                    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.
                    • 18913
                    • 654 Posts
                    Thanks for that comment re ContentFlow. It’s probably not going to get used anyway, as I prefer the sliding transition. Also thanks to both of you re QuickManager. On to image area tagging ...

                    I have wanted to implement image area tagging such as found in this demo :

                    http://neillh.com.au/phototagging2/index.php

                    So I started messing around with the code provided there, specifically

                    http://neillh.com.au/phototagging2/phototagging.rar


                    This was extracted to a local website such that its contents lived under
                    assets/snippets/phototagging

                    The database for the tags was created with this call in phpMyAdmin, with the table
                    becoming part of the MODx database:
                    CREATE TABLE phototags (
                       rec_id int(11) NOT NULL AUTO_INCREMENT,
                       pic int(11) NOT NULL,
                       title varchar(255) NOT NULL,
                       x1 int(11) DEFAULT NULL,
                       y1 int(11) DEFAULT NULL,
                       x2 int(11) DEFAULT NULL,
                       y2 int(11) DEFAULT NULL,
                       width int(11) DEFAULT NULL,
                       height int(11) DEFAULT NULL,
                       PRIMARY KEY (rec_id)
                    )
                    

                    (I changed the original "id" and "photoid" to be "rec_id" and "pic". In hindsight, I’m
                    not sure that it was necessary. My goal at the time was to avoid confusing myself regarding
                    what was getting used where ...)

                    For use in Easy2Gallery I created a document for a "landing page" and in my case it’s id was 51. So that’s where that number is coming from below.

                    Main Easy2Gallery call ;
                      [!easy2? &slideshow=`smoothgallery` &ss_config=`slidingtransition` &landingpage=`51`!]
                    


                    Landing page contents :
                    <div class="picture">
                      [!phototagging_form_e2g!]
                        [!easy2? &page_tpl=`areatag_chunk` &landingpage=`51`!]
                      [!phototagging_content_e2g!]
                    </div><!-- class picture -->
                    


                    Calls added to "head" section of template used by landing page :
                    <link rel="stylesheet" href="assets/snippets/phototagging/css/style.css" type="text/css" media="screen" />
                    <link rel="stylesheet" type="text/css" href="assets/snippets/phototagging/css/imgareaselect-animated.css" /> 
                    <script type="text/javascript" src="assets/snippets/phototagging/js/jquery-1.4.2.min.js"></script>
                    <script type="text/javascript" src="assets/snippets/phototagging/js/jquery.imgareaselect.pack.js"></script>
                    <script type="text/javascript" src="assets/snippets/phototagging/js/jquery.load.js"></script>
                    


                    Snippet call placed (immediately, in my case) after opening "body" tag in template used by landing page ...
                    [!phototagging_function_e2g!]
                    


                    Code for phototagging_function_e2g :
                    <?php
                    	global $modx;
                    	
                    	//Function to sanitize values received from the form. Prevents SQL injection
                    	function clean($str) {
                    		$str = @trim($str);
                    		if(get_magic_quotes_gpc()) {
                    			$str = stripslashes($str);
                    		}
                    		return $str; //$modx->db->escape($str);
                    	}
                    	if($_POST['tag']) {
                    		//Sanitize the POST values
                    		$title = clean($_POST['title']);
                    		$x1 = $_POST['x1'];
                    		$y1 = $_POST['y1'];
                    		$w = $_POST['w'];
                    		$h = $_POST['h'];
                                    $fid = $_GET['fid'];
                    
                    		//Insert tag into database.
                    		$qry = " INSERT INTO phototags (rec_id, title, x1, y1, x2, y2, width, height,pic) " .
                    		" VALUES('', '".$title."', '".$x1."', '".$y1."', '".$_POST['x2']."', '".$_POST['y2']."', '".$w."', '".$h."', '".$fid."') "; 
                    		$result=$modx->db->query($qry);  //MattC
                    	} elseif($_GET['delete']) {
                    		//Sanitize the POST values
                    		$rec_id = clean($_GET['rec_id']);
                    		$qry = " DELETE FROM phototags where rec_id = $rec_id ";  //MattC
                    		$result=$modx->db->query($qry);  //MattC
                    	}
                    return;
                    ?>
                    


                    Code for "phototagging_form_e2g" snippet :
                    <?php
                    $fid = $_GET['fid'];
                    $output = '';
                    
                    $output .= '<div class="start-tagging">Click here to start tagging</div><!-- class start tagging -->';
                    $output .= '<div class="finish-tagging hide">Click here to cancel tagging</div><!-- class finish tagging -->';
                    $output .= '<div class="image">';
                    $output .= '  <div id="title_container" class="hide">';
                    $output .= '	<form method="post" action="[~[*id*]~]?fid=' . $fid . '" >';
                    $output .= '		<!-- Grab the X/Y/Width/Height -->';
                    $output .= '		<input type="hidden" name="x1" id="x1" value="' . $x1 . '" />';
                    $output .= '		<input type="hidden" name="y1" id="y1" value="' . $y1 . '" />';
                    $output .= '		<input type="hidden" name="x2" id="x2" value="' . $x2 . '" />';
                    $output .= '		<input type="hidden" name="y2" id="y2" value="' . $y2 . '" />';
                    $output .= '		<input type="hidden" name="w" id="w" value="' . $w . '" />';
                    $output .= '		<input type="hidden" name="h" id="h" value="' . $h . '" />';
                    $output .= '		<input type="hidden" name="pic" id="fid" value="' . $fid . '" />';
                    $output .= '		<label for="title">Tag text</label><br />';
                    $output .= '		<input type="text" id="title" name="title" size="30" value="" maxlength="55" /><br />';
                    $output .= '		<input type="hidden" name="tag" value="true" />';
                    $output .= '		<input type="submit" value="Submit" class="" />';
                    $output .= '	</form>';
                    $output .= '  </div><!-- id title container -->';
                    
                    return $output;
                    ?>
                    


                    Code for "phototagging_content_e2g" snippet :
                    <?php
                    global $x1, $y1, $x2, $y2, $w, $h;
                    
                    $fid = $_GET['fid'];
                    
                    $output = '';
                    
                    $list_tags = array();
                    
                    $qry = " SELECT rec_id, title, x1, y1, x2, y2, width, height FROM phototags WHERE pic=".$fid;
                    echo $qry;
                    $results=$modx->db->query($qry) or die("Error retrieving record: " . mysql_error());
                    while ($row=$modx->db->getRow($results)) 
                    {
                      extract ($row);
                      $name = str_replace(' ', '-', $title);
                      $list_tags[] = array('rec_id' => $rec_id, 'title' => $title);
                    
                      $output .= 	'<!-- Style for the tagged area -->';
                      $output .= 	'<style type="text/css">';
                      $output .= 	'	.map a.'.$name.' { border:1px solid #000; top:'.$y1.'px; left:'.$x1.'px; width:'.$width.'px; height:'.$height.'px; }';
                      $output .= 	'	.map a:hover.'.$name.' { border:3px solid #fff; }';
                      $output .= 	'</style>';
                      $output .= 	'<!-- Tags displayed as a list -->';
                      $output .= 	'<ul class="map">';
                      $output .= 	'	<li><a class="'.$name.'"><span><b>'.$title.'</b></span></a></li>';
                      $output .= 	'</ul>';
                    }
                    
                    $output .= '</div><!-- class image -->';
                    $output .= '<p>In this photo:';
                    
                    foreach ($list_tags as $value)
                    {
                        $output .= "<a href='" . str_replace(' ', '-',$value['title']) . "'>" . $value['title'] . "</a> (<a href='[~[*id*]~]&fid=".$fid."&delete=true&rec_id=" . $value['rec_id'] . "'>Delete</a>)  ";
                    }
                    
                    $output .= '</p>';
                    
                    return $output;
                    ?>
                    


                    Chunk used for page template ("areatag_chunk") :
                    <div class="landingpage">
                        <div class="image">
                            <img src="[+easy2:src+]" alt="[+easy2:title+]" width="100%" class="imageview" id="imageid">
                        </div>
                        <div class="imagetitle">[+easy2:title+]</div>
                        <div class="imagedesc">[+easy2:description+]</div>
                    </div>
                    


                    The above code is the result of trying to get the image area tagging to work under various circumstances. So it is no doubtedly inefficient and/or filled with extraneous code. Or maybe it’s wrong in places in that it could be more bullet proof. But on a localy installation it seems to be working. That said, I’d be interested in seeing better implementations and learning from how others would change the code. My hope is that it at least provides a starting point/proof-of-concept ...

                    Regards,
                    Matt

                    PS One thing I have noticed is that the image area tagged may be off a bit from where it is drawn depending on margins, padding, etc. used by the containing div. And I’m not sure the form-interaction-with-php is as tidy as it could be. FWIW ...
                      • 26931
                      • 2,314 Posts
                      Hey Matt smiley awesome, thanks for sharing!

                      ... what will be shown on the landing page? a gallery with all images related to the tag?

                      thanks, j