We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Any information on adding an image field to a CRC using ClassExtender?
      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
      • 3749
      • 24,544 Posts
      If you just want to store the path, it's a regular text field.

      If you want to store attributes along with it, they'd either have to be separate fields or you'd have to do some custom work.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
      • I meant having the editing field open the file browser. Like SimpleCart product pages has.
          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
        • Looked up SC's javascript and found this, which I presume would go, after some modification of course, in the "MyExtraResourceFields" chunk
                          xtype: 'modx-combo-browser'
                          ,fieldLabel: _('simplecart.resource.product_image')
                          ,name: 'product_image'
                          ,id: 'simplecart-product-resource-image'
                          ,anchor: '100%'
                          ,source: imageSource
                          ,hideSourceCombo: true
                          ,listeners: {
                              'select': {
                                  fn: function(data) {
                                      MODx.fireResourceFormChange();
                                      var d = Ext.get('simplecart-product-resource-imagepreview');
                                          d.update('');
          
                                      if (!Ext.isEmpty(data.url)) {
                                          var imageUrl = MODx.config.connectors_url+'system/phpthumb.php?h=150&w=200&src='+data.url+'&wctx=web&source='+imageSource;
                                          d.update('<img src="'+imageUrl+'" alt="" />');
                                      }
                                  }
                                  ,scope: this
                              }
                          }
                      },{
                          html: '<div id="simplecart-product-resource-imagepreview">' +
                              ((config.record.product_image) ? '<img src="'+MODx.config.connectors_url+'system/phpthumb.php?h=150&w=200&src='+config.record.product_image+'&wctx=web&source='+imageSource+'">' : '') +
                              '</div>'
                          ,border: false
                      },{
          
            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
            • 3749
            • 24,544 Posts
            That sounds right to me. CE will just respond to the field's text content on submission (assuming that it's a real submission and the fields are set in the $_POST). CE doesn't care how it gets there.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 45766
              • 78 Posts
              Hi, its an old post, but an actual problem for me wink

              I would like to add a second Image to a user. I understood that i just have to add a input type=text to save the path to the image.

              But it would be much nicer if the user could use the Media Manager.

              Susans solution sound like the JS would open the media browser but i am totally lost how to use it.

              Any Ideas? [ed. note: stefan79w last edited this post 6 years, 6 months ago.]