2 Replies Latest reply on Sep 9, 2017 12:29 AM by ays.hakkim@yahoo.com

    How to read dragged image from (Browser to Layout)

    vinothr Level 3

      When I drag an image from browser into the layout, the external flavor is kPasteboardTypeFileURLPromiseExternalFlavor

      Now, I try to handle this external flavor in my flavor helper's ProcessDragDropCommand.

      I try to internalize as follows:

       

      controller->InternalizeDrag(kNoExternalFlavor, kMyDragDropCustomFlavor);

       

      kMyDragDropCustomFlavor is supported via my custom data exchange handler.

      Have overridden CanInternalizeData and Internalize data in my data exchange handler.

       

      My biggest hurdle: is in reading the dragged item from IPMDataObject as stream.

      IPMDataObject::GetStreamForReading never gives me the stream.

       

      NOTE: I at least expect to read the URL of the image dragged and not the entire image stream.

      When you drag an image from browser to InDesign layout (in Windows version), a text box is created with URL data.

       

      I would like to achive the same. I would appreciate if someone can shed light on this.

        • 1. Re: How to read dragged image from (Browser to Layout)
          vinothr Level 3

          Ok, I have found few things as follows:

           

          1. Dragging image from Chrome gave me external flavor as kPasteboardTypeFileURLPromiseExternalFlavor

          I got this message when trying to read the flavor data:

          MClipboardDataObject::GetSizeOfFlavorData

          PasteboaredCOpyItemFlavorData failed: itemID(1), OSErr -25133, 25132

           

          2. Tried in Safari. Got external flavor as kTEXTExternalFlavor

          I internalized as controller->Internalize(kTEXTExternalFlavor, kMyCustomFlavor);

          In my DE handler, I am able to read the image URL from the IPMObjectStream now.

           

          Interesting, if you normally drag an image from Safari browser to InDesign layout, you get the image placed (as embedded).

          What is different with Chrome is not clear?

           

          Anyhow, am on my way to place image from Safari and get that linked to the website from where it is dragged.

          1 person found this helpful
          • 2. Re: How to read dragged image from (Browser to Layout)
            ays.hakkim@yahoo.com Level 1

            Hi Vinoth

             

            Did you able to link that image directly to that URL? Instead of downloading locally, and link it.

             

            thank you

            Hakkim