<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />I have a URL, say:
https://fieldagent.co.uk/client/lightbox/?public_id=20639c06-a6ed-5a4f-9436-d9cf9e41adf8&mt=7&g=329914&q=82202
That is not an image itself (no file as .jpg, .png). But it does refer to the following image file:
https://fieldagent-app.s3.amazonaws.com/capturedMedia/21/2015/189/pic_6dtx0NWjfPSH.jpg
This file reference I could easily add to an expression column using the formula:
New Image( Open( "https://fieldagent-app.s3.amazonaws.com/capturedMedia/21/2015/189/pic_6dtx0NWjfPSH.jpg" )
How do I get from the URL to the image in JMP?
I tried using Internet Open(). If I use "as Text" in Internet Open(), then I can find the .jpg reference in that text. But that seems a very complicated approach to get what I want.
Yes, I missed the real question.
you can extract the URLs from the HTML, something like this.
text = Open( "https://fieldagent.co.uk/client/lightbox/?public_id=20639c06-a6ed-5a4f-9436-d9cf9e41adf8&mt=7&g=329914&q=82202" );
hrefs = {};
nhrefs = 0;
Pat Match(
text,
("href=" | "src=") + ("'" | "\!"") >> quotechar + Pat Break( Expr( quotechar ) ) >> hrefs[1 + nhrefs++] + Expr( quotechar ) + Pat Fail()
);
Show( nhrefs, hrefs );
nhrefs = 14;
hrefs = {"/site_media/images/public/favicon.ico",
"/site_media/js/jquery-1.7.2.min.js",
"/site_media/js/jquery-ui-1.8.custom.min.js",
"/site_media/js/jquery.query-2.1.7.js",
"/site_media/js/jquery.cookie.js",
"/site_media/js/jquery.lightbox-0.5.min.js",
"/style/css/jquery_theme/jquery-ui-1.8.custom.css",
"/style/css/lightbox.css",
"/style/css/jquery.lightbox-0.5.css",
"https://fieldagent-app.s3.amazonaws.com/capturedMedia/21/2015/189/pic_6dtx0NWjfPSH.jpg",
"https://fieldagent-app.s3.amazonaws.com/capturedMedia/21/2015/189/pic_6dtx0NWjfPSH.jpg",
"http://maps.google.com/maps?q=51.54,-0.00",
"https://fieldagent-app.s3.amazonaws.com/capturedMedia/21/2015/189/pic_6dtx0NWjfPSH.jpg ",
"\!" + gaJsHost + \!"stats.g.doubleclick.net/dc.js"};
PatMatch(...) uses the pattern in the 2nd argument to parse the text in the first argument (which is the HTML of the web page). The pattern matches either href= or src=, followed by either an apostrophe or quotation mark (which is stored into the quotechar variable). PatBreak(...) then matches everything up to the break character, which is expr(quotechar) because it needs the current value of quotechar, not the value when the PatMatch began. The PatBreak() text is the URL without the quotes, and is stored into the list hrefs. For good luck, match the trailing quote, then use the PatFail() function to make the pattern matcher try again and again until the text is used up.
The odd href at the end came from

which shows the ' and " nesting. It also hints that this sort of web scraping isn't always going to work when JavaScript is involved...the JavaScript won't be executed and won't build the URLs. But the .jpg you are looking for is in the list (3 times). You might use
for(i=1,i<=nhrefs, i++,
if ( endswith(hrefs,".jpg"), write(hrefs);break(); );
);
to grab one of them.
This misses Bea's actual question.
The first URL she gave (from fieldagent.co.uk) is apparently a redirect to the second URL she gave (on amazonaws). She needs a way to JMP to follow the redirect and get the associated image and right now it looks like the only way to do that is to open the link first as text and see whether it contains a redirect. She's hoping for an easier solution.
New Table( "pictures",
New Script( "download pictures", For Each Row( pic = Open( url,"png" ); ) ),
New Column( "pic",Expression),
New Column( "url",
Character,
"Nominal",
Set Values( {"https://fieldagent-app.s3.amazonaws.com/capturedMedia/21/2015/189/pic_6dtx0NWjfPSH.jpg",
"https://community.jmp.com/servlet/JiveServlet/downloadImage/38-1224-11190/Pleiades.png",
"https://community.jmp.com/servlet/JiveServlet/showImage/38-1218-11084/progress.PNG",
"https://community.jmp.com/servlet/JiveServlet/showImage/38-1195-10392/map.png",
"https://community.jmp.com/servlet/JiveServlet/showImage/38-1176-10134/wallPaper.png"
} )
)
);
The download script is attached to the table. Not sure how long those extra URLs will stay live. "png" makes sure open produces an image, it usually does not need to match the actual image type. "jpg" or "gif" also work. Without that extra parameter, JMP might open the image in an image viewer for your OS.