Jdunning Posted August 27, 2012 Share Posted August 27, 2012 I am looking for a simple rule to include in the Graphic insert rule that would check the data file for the orientation and if the value is 0 do nothing but if the orientation is 2700 it would rotate the image. Thanks Link to comment Share on other sites More sharing options...
Dan Korn Posted August 27, 2012 Share Posted August 27, 2012 Please refer to this thread: http://forums.pti.com/showthread.php?t=420 Link to comment Share on other sites More sharing options...
Jdunning Posted August 27, 2012 Author Share Posted August 27, 2012 I have downloaded the sample file and looked at it and I am looking for a way to set the image box orientation from the javascript ie if I could add the ImgHorizontal1 field as a Var if it returns 0 then nothing if it returns 2700 then change the image orientation? var Var1 = "Image1"; var Var2 = ".jpg"; var Var3 = ""; var Var4 = Field("ImagePath1"); var Var5 = Field("ImgHorizontal1"); temp = ''; var_extension = ''; has_extension = ''; if (Var3 == "") Var3 = Var3; else { if (FusionPro.isMac) Var3 = Var3 + ":"; else Var3 = Var3 + "\\"; } for (i=0; i<Field(Var1).length; i++) { temp = Mid(Field(Var1), Field(Var1).length-i,1); var_extension = temp + var_extension; if(var_extension == ".png" || var_extension == ".pdf" || var_extension == ".gif" || var_extension == ".eps" || var_extension == ".tif" || var_extension == ".tiff" || var_extension == ".jpg" || var_extension == ".jpeg") { has_extension = "true"; i=Field(Var1).length; } else has_extension = "false"; } if(has_extension == "true") Pic = CreateResource(Var3 + Field(Var1), "graphic", true); else { if(Var2 == ".jpg") { Pic = CreateResource(Var3 + Field(Var1) + ".jpeg", "graphic", true); if (Pic.exists) Pic = Pic; else Pic = CreateResource(Var3 + Field(Var1) + ".jpg", "graphic", true); } if(Var2 == ".tif") { Pic = CreateResource(Var3 + Field(Var1) + ".tif", "graphic", true); if (Pic.exists) Pic = Pic; else Pic = CreateResource(Var3 + Field(Var1) + ".tiff", "graphic", true); } if(Var2 == ".png" || Var2 == ".pdf" || Var2 == ".eps" || Var2 == ".gif") { Pic = CreateResource(Var3 + Field(Var1) + Var2, "graphic", true); } } if (Pic.exists) { return Pic; } else { return CreateResource(Var3 + Var4, "graphic", true); } Link to comment Share on other sites More sharing options...
Dan Korn Posted August 27, 2012 Share Posted August 27, 2012 You don't set the orientation of the box in JavaScript. In the example, you have two boxes, one for landscape images, one for portrait images, each of which calls a rule which determines whether it can accommodate the graphic. If you already have a rule returning a graphic resource, then that doesn't need to be modified. Just change the first line of each rule ("landscape" and "portrait" in the example) to call out your existing rule, like so: var MyResource = Rule("YourGraphicRule"); Link to comment Share on other sites More sharing options...
Jdunning Posted August 27, 2012 Author Share Posted August 27, 2012 var MyResource = Rule("Insert Pose 8"); if (IsResourceLandscape(MyResource)) return MyResource; //else return NullResource(); I get an error line 2 ReferenceError: IsResourceLandscape is not defined Link to comment Share on other sites More sharing options...
Dan Korn Posted August 27, 2012 Share Posted August 27, 2012 I get an error line 2 ReferenceError: IsResourceLandscape is not defined You need to copy the function from the JavaScript Globals in the sample job to the JavaScript Globals in your job. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.