4 Replies Latest reply on Feb 27, 2018 1:02 PM by Chad Armond_872

    How to "undo" a photo that is marked for deletion

    L. Hagen Level 1



      two more little question for the publishing service:


      When I delete a photo from a published collection it becomes part of "Deleted Photos to Remove" (until I haven't pressed the publish button). But how can I remove the photo from this section again (call it "undo")? E.g. for that case that the user has noticed that the photo shall not be removed...


      Another question is: there is the method "deletePhotosFromPublishedCollection". Now for example the webservice returns an error e.g. that the image could not be removed from the server. That's fine, but in this case I also wouldn't remove the image from my publication service and would like to stop that

      deletePhotosFromPublishedCollection function without calling the "deletedCallback( photoId )".


      So is there a way to end the deletePhotosFromPublishedCollection function without any action (and/or excpetion)?





        • 1. Re: How to "undo" a photo that is marked for deletion
          Allen Gambrell

          I have been trying to figure this out for 2 days.


          How do we tell Lightroom that the photo cannot be deleted from the server, thus

          disallow the delete action by the user?


          Also how to I reset the photo back to published if I need to, even if the user tried to delete it.


          Third, How is the user supposed to cancel the delete, like if he pressed delete on the wrong image. Other than undo, because we loose that when Lightroom is closed.

          • 2. Re: How to "undo" a photo that is marked for deletion
            Drarvik Adobe Employee

            The re-publish status of a photo can be manipulated through an LrPublishedPhoto instance. (Though, there appears to be a bug in that the effect is the opposite of what the documentation says. A bug has already been filed on that.)


            LrPublishedPhoto instances can be obtained from LrPublishedCollection objects. If you have an LrPhoto object, you can find which LrPublishedCollection instances contain it via the 'getContainedPublishedCollections' call.


            If you need to allow the user to explicitly change the re-publish status of a photo, perhaps a menu item which operates on the target photo is one way? (I haven't actually tried this, but it seems like it should be possible.)

            • 3. Re: How to "undo" a photo that is marked for deletion
              abazizis Level 1

              Dear Hagen and Dravik,


              I have made a few discoveries after careful observation of the deletePhotosFromPublishedCollection method:


              1. The method will not be called after you remove a photo from a publishedCollection. The photo will be merely placed under the Photos to remove section of the publishedCollection. The actual invocation of the method will occur after you pressed the publish button. apparently Publish button will do: (1) Remove any photo mark for removal; (2) Publish any photo marked for publication.


              2. After you mistakenly mark a published photos for removal, there is no way to change the status back to published or at least republish. which I think the desired behavior. At least here you should be able to take a last look at the photo and decide your final action as what to do to the photo. I am guessing that this is the buggy behavior Dravik was talking about. Because of the bug, you have to remove the photo from publication and add them again after the whole process ended. If you have a lot of photos and slow Internet, I suggest you decide before you press remove.


              3. Within the method deletePhotosFromPublishedCollection you only have limited information to work with as follows...

              a. publishSettings
              (table) The settings for this publish  service, as specified by the  user in the Publish Manager dialog. Any changes that you make in this  table do not persist beyond the scope of this function call.
              b. arrayOfPhotoIds
              (table) The remote photo IDs that were  declared by this plug-in  when they were published.
              c.  deletedCallback
              (function) This  function must be called for each photo ID as soon  as the deletion is confirmed by the remote service. It takes a single  argument: the photo ID from the arrayOfPhotoIds array.

              I for one would love to know the publishedCollection this function if refering to. It is common sense I guess. A more comprehensive parameters like in the processRenderedPhotos would be more beneficial and give better control to the plugin developer to control plugin behavior during deletion or removal of photos. Especially for cleaning up plugin specific metadata. I have look at numerous plugin that leave their custom metadata uncleaned. Even after I totally remove their plugin from my system.


              That is all for now..



              Just to add... Funny... guess what.. if you mark a photo for removal in published collection.. you can press Ctrl+Z or Menu "Edit"->"Undo" you can reset the remove from collection action... : which the context menu cannot do...hope this help...

              • 4. Re: How to "undo" a photo that is marked for deletion
                Chad Armond_872

                It seems that the SDK is forcing me to remove the photo from the collection regardless of whether the delete action on the server succeeded.  Here is what I would like to be able to do:



                local deleteSuccess = MyAPI.deleteImage( photoId )  if deleteSuccess then      deleteCallback( photoId )  else      LrDialogs.showError("Unable to remove " .. photoId .. " from collection")  end