rdechant Posted July 11, 2011 Share Posted July 11, 2011 Pic = CreateResource("http://assets.lincolnelectric.com/assets/en_US/Products/" (Field("MATERIAL") "/1200x1200.jpg", "graphic", true); if (Pic.exists) return Pic; else return Resource("PhotoNotAvailable"); Link to comment Share on other sites More sharing options...
rdechant Posted July 12, 2011 Author Share Posted July 12, 2011 How can I code the dynamic folder names? Link to comment Share on other sites More sharing options...
Dan Korn Posted July 12, 2011 Share Posted July 12, 2011 I would expect you to get a syntax error in your rule as posted. You need a couple plus signs in there to concatenate the strings properly in JavaScript: Pic = CreateResource("http://assets.lincolnelectric.com/assets/en_US/Products/" [color=DarkRed][b]+[/b][/color] Field("MATERIAL") [color=DarkRed][b]+[/b][/color] "/1200x1200.jpg", "graphic", true); Also, you can't test for the existence of a graphic resource from the Internet with the .exists property, since the file is not downloaded until it's used. So the rule should just be one line like this: return CreateResource("http://assets.lincolnelectric.com/assets/en_US/Products/" + Field("MATERIAL") + "/1200x1200.jpg"); You can always place the "photo not available" picture in a separate graphic frame below the one which gets the picture from the Internet, so it gets covered up when the online resource is found. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.