3 Replies Latest reply on Jun 18, 2008 1:42 PM by (Dave_Saunders)

    Placing GIFs in CS2

    Level 1
      Does anyone have any experience of placing inline GIF files in CS2? I have a script that attempts to place a series of inline GIFs each at 12% horizontal and vertical scale. And the weirdest thing is happening. The first one gets placed just fine at 12%. I place the second one and in spite of an alert confirming that it is at 12%, it changes to 100% as does the first one which was definitely at 12% a few moments earlier and which I've not touched again (other than to issue a recompose to the story containing the inlines).

      It makes no difference whether I have Transform Content on or off.

      Why, am I using GIFs? Because MathType offers only EPS files and GIFs and some weird conflict between the Symbol font it uses and the one InDesign uses (not clear to me why they can't be the same Symbol font) causes some characters to be messed up in the EPS files. So, we're trying to use 600 ppi GIF files, which InDesign thinks are 72 ppi, so I'm trying to place them at 12%.
        • 1. Re: Placing GIFs in CS2
          Level 1
          Here's the guts of the script:
          function insertEqn(name, doc, eqn) {
            app.findPreferences = app.changePreferences = null;
            var myFinds = doc.search("<<" + name + ">>", false, false, undefined);
            for (var j = myFinds.length - 1; j >= 0; j--) {
              myFinds[j].appliedCharacterStyle = "AutoLeading";
              var myIndex = myFinds[j].index;
              var myStory = myFinds[j].parentStory
              if (name.toLowerCase().indexOf(".eps") > -1) {
                // eps equation
                app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
                app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
                var myObjStyle = getObjStyle(eqn,doc);
              } else {
                // gif equation; needs to be placed at 12% of actual size
                var myIP = myStory.insertionPoints[myIndex];
                myFinds[j].contents = "";
                var myFrame = myIP.textFrames.add();
                myFrame.contentType = ContentType.graphicType;
                myFrame = myFrame.getElements()[0];
                app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
                myFrame.horizontalScale = 12;
                myFrame.verticalScale = 12;
                app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
                myFrame.graphics[0].horizontalScale = 12;
                myFrame.graphics[0].verticalScale = 12;
              if (myIndex > 0) {
                var myPrefix = myStory.characters[myIndex - 1];
                if (" \t".indexOf(myPrefix.contents) == -1) {
                  myPrefix.appliedCharacterStyle = "No Break";
              if (myStory.length > myIndex + 2) {
                var myPostfix = myStory.characters[myIndex + 1];
                var myPostPostfix = myStory.characters[myIndex + 2];
                if (myPostfix.contents == " " && ".,;:".indexOf(myPostPostfix.contents) != 0) {
                  myPostfix.appliedCharacterStyle = "No Break";
                  myPostPostfix.appliedCharacterStyle = "No Break";

          And here's the loop that calls this function:
            var eqnFolder = getEqnFolder(aDoc);
            var myEqns = eqnFolder.getFiles(epsOrGif);
            for (var j = myEqns.length - 1; j >= 0; j--) {
              var myName = myEqns[j].name;
              insertEqn(myName, aDoc, myEqns[j]);
          After the first time around the loop (i.e., after calling the funciton once with a .gif image) the first image is inline at 12%. After the second time around the loop, both the first and second and flipped to 100%. Is this a known bug in CS2? Or am I being blind-sided by something obvious?


          • 2. Re: Placing GIFs in CS2
            Level 1
            if you can get the gif image width and height, this will be very easy.
            (How to get the gif width and height, please us other propgram and list them.)

            You just use this:
            var myFrame = where.textFrames.add(undefined, undefined, undefined, {verticalScale: 100*height/10, horizontalScale:100*width/10});
            myFrame.place(imgFile, false);

            On the other hand, you can change the EPS File and correct the "BUG", please use UltraEdit to try it.

            • 3. Re: Placing GIFs in CS2
              Level 1
              The problem I'm having is that having correctly set the width and height on first placing the image, it seems to be springing back to 100% later (which is really weird).

              I'm going to try the same thing tomorrow with CS3 to see if the same thing happens. If not, then I can just write it off as a CS2 bug. If so, then I need to take a very careful look at my script to see if I'm overlooking something where the script is actually causing the scale to reset.