Can you show us the code that doesn't work?
The code works per se, however it causes the parent to lose it's insertionpoint (don't know if that's the name, maybe anchorpoint?). So the image wont be shown in the correct spot that is determined by our object style. We have pinpointed the problem in the script to the line below, however the problem is inconsistent:
item.parent.geometricBounds = [gb, gb, gb+newHeight, gb+newWidth] ;
When you work the bounds that way, you are taking responsibility for the anchor point. By adjusting the geometry in the way you did, you are choosing top-left as the anchor.
For any other anchor, use the appropriate math.
I don't think anchorpoint is the correct word for what I'm intending to say or perhaps it is.
Let me try to explain my problem futher...
Under my object format there is a tab (freely translated) that says "alternatives for anchored object".
Here you can choose to display your image in relation to an anchorplacement, assigning X and Y values. I think it's this reference point to where the image was inserted.
When the problem occurs not only the rectangle is moved way off (it's no longer visable), the same goes for another image with insertionpoint next to it (this one is working as should) and the text next to them).
Not easy to describe this problem, especially for a novice user.
We thought the problem was solved after using .EPS files instead of .PSD files on the problem images as that temporarily solved it. However we added more images, this time EPS and the problem is back.