Jump to content

Pull Images from website


rdechant

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...