We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17249 ☆ A M B ☆
    • 165 Posts
    Do you have some logs in error console?
    It is recommended to uninstall first all previous MIGx packages first.

    Also check in this part of your YOURCONFIG.config.inc.php
    <?php
     
    if (isset($_REQUEST['iframeTpl']) && $_REQUEST['iframeTpl']=='ajaxupload.html'){
        $_REQUEST['resource_id'] = '1';// we need any resource-id of a resource in the correct context, just to get the context
        $_REQUEST['tv_name'] = 'objectimage';// we need a image-tv with the correct mediasource in this context     
    }
    


    if a Resource with ID = 1 exists and there's a tv called objectimage with your dynamic mediasource.
      • 3866 ☆ A M B ☆
      • 350 Posts
      Just for clarity did you copy all the files in migx to a custom folder, if so how is the accessed? Via config setting in MIGXdb?

      Thanks for help
        Helen Warner
        Number one pixel!
        Proud to be linked with MODX at Crimson Pixel
        • 4172
        • 5,888 Posts
        do you have created your own MIGX-configuration?

        Than you need just create a new file under YOURPACKAGE/migxconfigs/YOURCONFIG.config.inc.php

        YOURCONFIG is the name of your own MIGX-configuration.
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 3866 ☆ A M B ☆
          • 350 Posts
          Hi Bruno, yes I created the config file name resourcealbum.config.inc.php (the name of the MIGX config for the multifileuploaded) and placed it under my package 'lettings' under the directory lettings/migxconfigs/resourceablum.config.inc.php (content below).

          <?php
           
          if (isset($_REQUEST['iframeTpl']) && $_REQUEST['iframeTpl']=='ajaxupload.html'){
              $_REQUEST['resource_id'] = '1';// we need any resource-id of a resource in the correct context, just to get the context
              $_REQUEST['objectimage'] = 'objectimage';// we need a image-tv with the correct mediasource in this context    
          }


          Under the formtab of the MIGXdb Lettings where I want to use the multifile uploaded I've created the following entry.

          Fieldname: image
          Caption: Add images
          InputTV: objectimage (name of image TV with relevant mediasource)

          On the Mediasources tab have added:

          source From: tv
          Sources: context: web
          source ID: 4
          content: mgr
          source ID: 4

          All I get is an image TV option not the multifile-uploader.
            Helen Warner
            Number one pixel!
            Proud to be linked with MODX at Crimson Pixel
            • 3866 ☆ A M B ☆
            • 350 Posts
            Ok big jump forward I have the mutlifile uploader working in the manager and it is now creating files under the res folder, however when I look in the database there is only [] and not a list of images.

            The TV I set up called objectimage was MIGX with configuration resourcealbum and mediasource set to ObjectMediaPath and that makes the folder creation correct but it doesn't actually add the information in the database.

            The data doesn't appear to be stored either because when I next check the entry the images have not been retained.

            There are errors (inevitably!) which are as follows:

            [2013-06-26 11:41:18] (ERROR @ /connectors/system/phpthumb.php) phpThumb was unable to generate a thumbnail for: /paas/c000/www/core/cache/phpthumb/phpThumb_cache_mysite.modxcloud.com_src797c8152f4d9fdbcf7e5abaf0c68780b_parfe75230c38c1dd77cfb659e43ae25583_dat0.jpeg
            [2013-06-26 11:41:18] (ERROR @ /connectors/system/phpthumb.php) Error outputting thumbnail:
            OutputThumbnail() failed because !is_resource($this->gdimg_output) in file "phpthumb.class.php" on line 557


            Any thoughts? I will try a couple of other things but would love to get this to work.
              Helen Warner
              Number one pixel!
              Proud to be linked with MODX at Crimson Pixel
              • 4172
              • 5,888 Posts
              Will put something together and report back, how to get this working.
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 3866 ☆ A M B ☆
                • 350 Posts
                Quote from: Bruno17 at Jun 26, 2013, 12:03 PM
                Will put something together and report back, how to get this working.

                Thank you Bruno, look forward to your input.
                  Helen Warner
                  Number one pixel!
                  Proud to be linked with MODX at Crimson Pixel
                  • 4172
                  • 5,888 Posts
                  ok, its a bit work involved to get the records syncronised with the uploaded/removed images.

                  first of, you will need MIGX 2.5.4
                  https://github.com/Bruno17/MIGX/blob/master/packages/migx-2.5.4-pl.transport.zip

                  then you will need a snippet, which handles the sync-stuff onUpload/onRemove

                  this should look something like that one:
                  https://github.com/Bruno17/migxcart/blob/master/core/components/migxcart/elements/snippets/migxcartonupload.snippet.php

                  you may need to change the fieldnames in this part:

                  $fields['product_id'] = $modx->getOption('co_id', $_REQUEST, 0);
                  $fields['filename'] = $modx->getOption('name', $scriptProperties, 0);
                  


                  In your mediasource add two new settings:

                  onImageUpload and onImageRemove.
                  As value add the name of the snippet to both, in my example it is migxcartonupload.

                  To get the images rendered in the grid, I used the renderChunk - renderer for the image-column.
                  see this part in my exported config:
                  https://github.com/Bruno17/migxcart/blob/master/core/components/migxcart/migxconfigs/migxcartimages.config.js#L89

                  Add one renderoption with the name of a chunk, which should look like that:
                  https://github.com/Bruno17/migxcart/blob/master/core/components/migxcart/elements/chunks/renderimagecolumn.chunk.html

                  ths snippet, I used, to get the path is this one:
                  https://github.com/Bruno17/migxcart/blob/master/core/components/migxcart/elements/snippets/getmigxcartfilepath.snippet.php

                  you may need to change the path.


                  If you want to have the feature to sort images by click/select-position you will need todo this steps:

                  add a field to your schema/table for the position, I named it pos

                  use the renderer this.renderPositionSelector for this column in the grid
                  see this part in my config:
                  https://github.com/Bruno17/migxcart/blob/master/core/components/migxcart/migxconfigs/migxcartimages.config.js#L110

                  dont't forget to select the Handler 'this.handlePositionSelector'
                  see this config-part:
                  https://github.com/Bruno17/migxcart/blob/master/core/components/migxcart/migxconfigs/migxcartimages.config.js#L52

                  you will also need a processor in your package, which does the reordering-stuff, see this one:
                  https://github.com/Bruno17/migxcart/blob/master/core/components/migxcart/processors/mgr/default/handlepositionselector.php

                  add this fieldname (in my case 'pos') into the MIGXdb-settings: defaultsort






                  [ed. note: Bruno17 last edited this post 13 years, 3 months ago.]
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 3866 ☆ A M B ☆
                    • 350 Posts
                    Whoa Bruno, looks like you've put loads of work into this.

                    Ok I've attempted to go through all the steps and I can now upload files via the multifile uploader and folders are created in respect of the ID of the database. However, images don't always end up in the right folder - when they are moved into the correct folder you can then load from mediasource and the images persist.

                    I have got the lettings/migxconfigs/resourceablum.config.inc.php still in place as above.

                    I changed the info in the following code to reflect my settings:

                    $fields['id'] = $modx->getOption('co_id', $_REQUEST, 0);
                    $fields['image_list'] = $modx->getOption('name', $scriptProperties, 0);


                    The following line of data is entered into the database under image_list

                    [{"MIGX_id":"1","image":"icon-3.png","deleted":"0"}]


                    At the moment, I haven't been able to access this information. Couldn't get the snippet getmigxcartfilepath to work even with adjusting the file path.

                    There's currently nothing in the error log either.

                    But think we're alot closer to achieving a very nifty solution for multiple uploading images in a MIGXdb.
                      Helen Warner
                      Number one pixel!
                      Proud to be linked with MODX at Crimson Pixel
                      • 17249 ☆ A M B ☆
                      • 165 Posts
                      I was just writing a reply to boomerang specifying the work until now didn't involved actually saving the data to the DB and then i saw this post.
                      This commits completes the process.

                      Thanks a lot Bruno for your help.
                      I will implement and report back about the result. [ed. note: lithiumlab last edited this post 13 years, 3 months ago.]