We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25991
    • 13 Posts
    Hi everybody,

    First I want to thanks Modx for this great CMS.

    I am now building my 2nd Modx site but as I am still newby with this (not a programmer) I am wondering how to set up Newspublisher to upload images like the Modx repository submission form with then the lightbox effect on the published page.

    Should I use the snippet Fileupload and insert it into the form or is it linked with Maxigallery or another way ? huh

    What I want to do is a cooking/recipes website with the users submitting their recipes with upload of the photo of the recipe.

    I found a lot of answers already on the forum but nothing related to this subject, if someone can help me with that or give me a direction where I should look for, this would be great grin

    Thanks a lot.

    Nathalie


      • 29655
      • 16 Posts
      I would also like some insight to this!

      Thank you in advance for your time
        • 32507
        • 142 Posts
        Yes! Me too. It’s hard to find some help for this subject.
          • 24531
          • 213 Posts
          bump.
            • 7231
            • 4,205 Posts
            Sorry, but I am not sure it is possible with newspublisher without rewriting some of the code. You can add an image via the TinyMCE interface. I would recommend using FDM since it has better TV handeling.
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don't know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 24531
              • 213 Posts
              ok that was a long road but finally i did it smiley

              step 1

              In manager/media/browser/mcpuk/connectors/php/config.php change the following:

              Replace

              if(!isset($_SESSION['mgrValidated'])) {
              	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the MODx Content Manager instead of accessing this file directly.");
              }


              With

              if(!isset($_SESSION['mgrValidated']) && !isset($_SESSION['webValidated'])) {
              	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the MODx Content Manager instead of accessing this file directly.");
              }


              step 2

              download and install Docmanager

              step 3

              open NewsPublisher snippet.

              add line somewhere on top;
              include_once($modx->config['base_path'] . 'assets/libs/docman/document.class.inc.php');


              you should correct path of include_once according to your setup.

              find line
                          $lastInsertId = $modx->db->getInsertId();


              add after:

              $doc = new Document($lastInsertId);
              $doc->Set('tvnewsImage',$_REQUEST['tvnewsImage']);
              $doc->Save();
              


              newsImage is tv which contains link on pic.

              step 4

              open your NewsPublisher tpl and add somewhere in form:
              <input id="tvnewsImage" type="text" style="width: 300px;" value="/assets/images/nafnaf.png" name="tvnewsImage"/>
              <input type="button" onclick="BrowseServer('tvnewsImage')" value="Add"/>
              


              and the last step

              put this in head section of your template:

              <script type="text/javascript">
              
              			var lastImageCtrl;
              							var lastFileCtrl;
              							function OpenServerBrowser(url, width, height ) {
              								var iLeft = (screen.width  - width) / 2 ;
              								var iTop  = (screen.height - height) / 2 ;
              
              								var sOptions = 'toolbar=no,status=no,resizable=yes,dependent=yes' ;
              								sOptions += ',width=' + width ;
              								sOptions += ',height=' + height ;
              								sOptions += ',left=' + iLeft ;
              								sOptions += ',top=' + iTop ;
              
              								var oWindow = window.open( url, 'FCKBrowseWindow', sOptions ) ;
              							}
              							
              								function BrowseServer(ctrl) {
              								lastImageCtrl = ctrl;
              								var w = screen.width * 0.7;
              								var h = screen.height * 0.7;
              								OpenServerBrowser('http://[color=red][b]yourdomain[/b][/color]/manager/media/browser/mcpuk/browser.html?Type=images&Connector=/manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=/', w, h);
              							}
              										
              							function BrowseFileServer(ctrl) {
              								lastFileCtrl = ctrl;
              								var w = screen.width * 0.7;
              								var h = screen.height * 0.7;
              								OpenServerBrowser('".$base_url."manager/media/browser/mcpuk/browser.html?Type=files&Connector=".$base_url."manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=".$base_url."', w, h);
              							}
              							
              							function SetUrl(url, width, height, alt){
              								if(lastFileCtrl) {
              									var c = document.mutate[lastFileCtrl];
              									if(c) c.value = url;
              									lastFileCtrl = '';
              								} else if(lastImageCtrl) {
              									var c =  document.getElementById(lastImageCtrl);
              									
              									if(c) c.value = url;
              									lastImageCtrl = '';
              								} else {
              									return;
              								}
              							}
              
              </script>
              



              HERE YOU GO!


              ps these steps are quick and dirty but it works!