- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Import Image from URL into Expression Column
I am trying to use the new Expression Role column in JMP12 to organize some images. I can drag an image into a cell from a webpage, but I would like to use a formula to add an image with a known URL pattern.
If I drag an image into the cell, I get a cell of the form,
New Image(Char To Blob( " /* bunch of stuff */ ", "base64compressed" ), "jpeg")
, but this requires me to manually drag each image into the data table. Can I add an image into a data table cell using a formula directly from the URL location? Something like:
New Image(" http://www.sas.com/content/dam/jmp/images/design/social-share/jmp-com-share.jpg ") // ?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Import Image from URL into Expression Column
New Image(Open(URL)); seems to work.
Example:
New Table("test", Add Rows(1), New Column("Image", Expression));
:Image[1] = New Image(
Open(
"http://www.sas.com/content/dam/jmp/images/design/social-share/jmp-com-share.jpg "
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Import Image from URL into Expression Column
New Image(Open(URL)); seems to work.
Example:
New Table("test", Add Rows(1), New Column("Image", Expression));
:Image[1] = New Image(
Open(
"http://www.sas.com/content/dam/jmp/images/design/social-share/jmp-com-share.jpg "
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Import Image from URL into Expression Column
Thanks MS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Import Image from URL into Expression Column
This is fantastic! Just what I was looking for!
I am not very knowledgeable in JSL, maybe someone can help me modify the proposed script to my need...
I modified the above to import an image from my computer resulting in:
New Table("test", Add Rows(1), New Column("Image", Expression));
:Image[1] = New Image("C:\Photos\Capture.png"
);
What I would love to have is a JSL script that I can save into an existing table and that, when run, would do the following:
- Look at table variable "Location" and read the folder path of the images I will want to import. Lets say this is "C:\Photos"
- Look at column 1 and read the content of cell 1 which is the name of the first image to import. lets say this is "holiday1"
- Join the path and the image name to plug it into the above script to import the image in cell 1 of "column 2"
- Loop through all the rows to import all the images.
It sounds feasible to me, just I do not know how to script many parts of the code. I am going to start researching on how to write this but if someone gets to a solution...:)
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Import Image from URL into Expression Column
You don't need a loop and this is faster anyways:
dt = New Table("test", Add Rows(1),
New Column("ImageTitle", Character, Nominal, Set Values({"Capture"})),
New Column("Image", Expression, Formula(New Image(dt:Location || :ImageTitle || ".png")))
);
dt << Set Table Variable("Location", "C:\Photos\");
Image with path C:\Photos\Capture.png will be displayed in column 2 (:Image)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Import Image from URL into Expression Column
Fantastic! That is exactly what I was looking for.
Thanks a lot for the help @msharp !