10 Replies Latest reply on Feb 4, 2009 12:13 PM by (Kamal_Sharif)

    setting export image size

      How do I set a fixed export size (that can't be overridden by the user) for files exported by my export service provider?

      I have hidden the image settings from the export panel via the following line in my service definition script:

      hideSections = { "imageSettings" },

      Then I've tried setting the default width & height in 3 different places -- none of which work.

      In my export service definition script:

      exportPresetFields = {
      { key = 'privacy', default = 'public' },
      { key = 'privacy_family', default = false },
      { key = 'privacy_friends', default = false },
      { key = 'safety', default = 'safe' },
      { key = 'hideFromPublic', default = false },
      { key = 'type', default = 'photo' },
      { key = 'addToPhotoset', default = false },
      { key = 'photoset', default = '' },
      { key = 'addTags', default = '' },
      { key = 'size_maxHeight', default = 200 },
      { key = 'size_maxWidth', default = 200 },

      In my presets template for my export provider:

      s = {
      internalName = "Test",
      title = "Test",
      type = "Export",
      value = {
      exportServiceProvider = "provider",
      exportServiceProviderTitle = "Provider Title",
      export_addCopyrightWatermark = false,
      initialSequenceNumber = 1,
      jpeg_quality = 0.6,
      metadata_keywordOptions = "flat",
      minimizeEmbeddedMetadata = false,
      size_doConstrain = true,
      size_doNotEnlarge = true,
      size_maxHeight = 200,
      size_maxWidth = 200,
      size_resizeType = "wh",
      size_userWantsConstrain = true,
      tokenCustomString = "",
      tokens = "{{image_name}}",
      version = 0,

      And in my export settings for when the export is initiated programmatically (not via the Export dialog):

      local exportSession = LrExportSession{
      exportSettings = {
      LR_exportServiceProvider = 'provider',
      privacy = 'private',
      size_doConstrain = true,
      size_doNotEnlarge = true,
      size_maxHeight = 200,
      size_maxWidth = 200,
      size_resizeType = "wh",
      size_userWantsConstrain = true,
      photosToExport = photos

      Thanks for any help,
        • 1. Re: setting export image size
          escouten Adobe Employee
          There's a hook function that you can provide on your export service provider called updateExportSettings. It takes a settings table that you can modify. It gets called after the export dialog is finished, but before any rendering has begun.

          Something like the following should work:

          updateExportSettings = function( settings )

          settings.LR_size_maxHeight = 400
          settings.LR_size_maxWidth = 400
          -- etc.


          Note that this is just off the top of my head and not tested.
          • 2. Re: setting export image size
            Level 1
            Thanks, Eric, for your response. That doesn't seem to work for me either. Added this to my export service definition script:

            updateExportSettings = function( settings )
            settings.LR_size_doConstrain = true
            settings.LR_size_doNotEnlarge = true
            settings.LR_size_maxHeight = 150 settings.LR_size_maxWidth = 150 settings.LR_size_resizeType = "wh"

            I checked the size of the settings table though and it's 0 both at the beginning and end of the method call. The size of exportContext.propertyTable in processRenderedPhotos is also 0. Is that odd? Any other advice for me?

            Thanks again,
            • 3. Re: setting export image size
              escouten Adobe Employee
              Peter, I inserted the code from your last comment into the Flickr sample plug-in and it appears to work fine (i.e. my uploaded photos are limited to 150px on the long side as expected).

              If you'd like me to look at your plug-in, feel free to send it to me (scouten@adobe.com).
              • 4. Re: setting export image size
                Level 1
                You're right. I tried it from scratch, and it works. I wonder if I was overriding the settings elsewhere...

                Anyway, thanks for your help!

                • 5. Re: setting export image size
                  Hello Peter,
                  could you please explain me how to "connect" a export template to the export service definition?
                  I'm trying to modify the ftp upload plugin, want to hide imageSettings and others, got also a export template (with all the settings) but do not know how to connect them (info.lua???).
                  Wonder if you could please give me a tip?
                  • 6. Re: setting export image size

                    The updateExportSettings seems to be barely documented. It is mentioned once in the LR SDK 2.0 manual (page 36), although in a quite incomplete manner. Would be nice to see this covered in future releases.


                    Usually there should be no need to handle template files manually. The input/settings (either restored from a template or from the last run) are provided to the plugin automatically. (Custom settings must be declared in exportPresetFields for this to work.) The data structure that holds them is called propertyTable in the ftp plugin example code.

                    In the end I can confirm that the approach works IF the updateExportSettings property (in the table returned by the LrExportServiceProvider file) is used (as shown above). Even works if the dialog section that usually provides the properties is hidden. I had serious trouble with this case before the updateExportSettings function was revealed.
                    • 7. Re: setting export image size
                      Level 1
                      thanks Herb
                      • 8. Re: setting export image size
                        Hello folks;
                        I have a very similar situation. I want to hide the file location section but enforce a specific location. I tried what you guys are suggesting:(or as I understood from you guys)
                        In my Export Service Provider:
                        {key='LR_export_destinationType', default='specificFolder'},
                        {key='LR_export_useSubfolder', default=true},
                        {key='LR_export_destinationPathPrefix'},--tried not inserting last two

                        and the function

                        updateExportSettings = function( settings )

                        and still, it goes back to 'tempFolder' when I show it in a dialog just in the beginning of processRenderedPhotoes

                        I am getting around this by copying the temp file created to the folder I am enforcing, but would like to avoid that copy if possible.

                        I appreciate your help. Thanks
                        • 9. Re: setting export image size
                          escouten Adobe Employee
                          Kamal, I just looked through this code and realized that you've tripped on a special case. There is code that resets the file location to 'tempFolder' if you have hidden the Export Location section of the dialog. This code fires *after* updateExportSettings is called, so if you are hiding that section of the dialog, there is really nothing you can do to cause LR to render the file to any other location.

                          That said, you could use LrFileUtils.move to move the file after LR is done with it (i.e. in your processRenderedPhotos function).
                          • 10. Re: setting export image size
                            (Kamal_Sharif) Level 1
                            Thanks Eric;
                            I figured out coz I was trying "anything" and it would fail. But what made no sense was I set the settings to nil in the updateExportSettings and everything still worked fine.

                            What right now I am doing is LrFileUtils.copy but I guess using move would be more efficient in terms of storage and only for a short time.