- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone, I'm attempting to insert images into a report I'm writing with report writing interface via URL. A specific image needs to be in every region on a page, and the image is stored on a web server. I use obj.image(file: myurl) and got the error unable to load image...default image will be used. Resources on image inserting via url don't seem to be plentiful. Any help and examples are much appreciated, and I'd also like to know if this image will be automatically sized to fit the region, and if not, how to can specify it's dimensions!
Thanks!
obj.region(
width:"1.9in", height: "3.2in",
x : "0in", y: "0in",
style_attr: "background=grey color=grey"
);
obj.image(file: 'my.com/url');
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
This example worked for me. It is a picture of Lewis Carroll available at a URL. I needed a fully qualified HTTP address for the URL.
cynthia
ods pdf file='c:\temp\testurl.pdf' notoc;
data _null_;
length pixloc $256;
if _n_ = 1 then do;
pixloc='http://img.bhs4.com/45/e/45e71f0d91fb0b65b98b129552466d58c2e46d6d_large.jpg';
end;
if _n_ = 1 then do;
dcl odsout obj();
obj.layout_gridded(columns:1);
end;
obj.region(width:"3.25in");
obj.image(file: pixloc ,
overrides:"just=left width=100pct");
if eof eq 1 then
obj.layout_end();
run;
ods pdf close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
This example worked for me. It is a picture of Lewis Carroll available at a URL. I needed a fully qualified HTTP address for the URL.
cynthia
ods pdf file='c:\temp\testurl.pdf' notoc;
data _null_;
length pixloc $256;
if _n_ = 1 then do;
pixloc='http://img.bhs4.com/45/e/45e71f0d91fb0b65b98b129552466d58c2e46d6d_large.jpg';
end;
if _n_ = 1 then do;
dcl odsout obj();
obj.layout_gridded(columns:1);
end;
obj.region(width:"3.25in");
obj.image(file: pixloc ,
overrides:"just=left width=100pct");
if eof eq 1 then
obj.layout_end();
run;
ods pdf close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm getting the following errors when running the code:
ERROR: Unable to load image
http://img.bhs4.com/45/e/45e71f0d91fb0b65b98b129552466d58c2e46d6d_large.jpg;
default image will be used instead.
The log file also has the following warning:
WARNING: ODS Report Writing Interface is not supported for TAGSETS.SASREPORT13(EGSR) destination. Results may be unpredictable.
However I've used RWI to generate reports on this machine/server before (Never with images though).
Any insights?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
My suggestion is that you put an
ODS _ALL_ CLOSE;
before the ODS PDF statement and make sure that your FILE= option is pointing to a location where you have WRITE access. Also, harder to check is that you will need to make sure your program, which is running on a server, can access a URL from the server machine. If your web folks have locked down the server so it cannot use an HTTP address, then you will have to move your images to an accessible location on the server. You may need an administrator's help with that.
My image was just a picture of Lewis Carroll that I found and used because it had a direct HTTP address. If you have your images on a network drive, then perhaps a simple folder path will work for you.
cynthia