<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Make stored process output only png image in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Make-stored-process-output-only-png-image/m-p/512939#M5809</link>
    <description>&lt;P&gt;I got a simple version working. like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let plotPath = &amp;amp;_tmpcat ; 
ods html 
	path=&amp;amp;plotPath
	style=xxx
	image_dpi=400
	device=png;

* proc sgplot ;

data _null_;
	file _webout;
	put '&amp;lt;img style="width:100%" src="https://xxx.xxx.be' &amp;amp;_REPLAY 'SGPlot2.png" &amp;gt;';
	run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I could not make the STP output a binary png file yet, so I had to output html img tag.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you are right I'm afraid &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;If I make several iframes pointing to this STP, they&amp;nbsp;load one at a time (sometimes worse, a&amp;nbsp;few will encounter errors).&lt;/P&gt;
&lt;P&gt;So it's definitely not usable on a public-facing website.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(I don't know anything about load balancing, I think we always have 1 process at a time on our sas jboss server.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Nov 2018 13:41:34 GMT</pubDate>
    <dc:creator>mathias</dc:creator>
    <dc:date>2018-11-14T13:41:34Z</dc:date>
    <item>
      <title>Make stored process output only png image</title>
      <link>https://communities.sas.com/t5/Developers/Make-stored-process-output-only-png-image/m-p/512129#M5806</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a (huge) Stored process that can make lots of graphs depending on the parameters.&lt;/P&gt;
&lt;P&gt;These graphs are outputted in ods html PNG format&amp;nbsp;+ non-embedded titles &amp;amp; footers, + a few other proc prints in general.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now&amp;nbsp;&amp;nbsp;I need to make a version that outputs only 1 image, (the main png that is written in an img tag in the html output)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;img &lt;SPAN class="html-attribute-name"&gt;alt&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;The SGPlot Procedure&lt;/SPAN&gt;" &lt;SPAN class="html-attribute-name"&gt;src&lt;/SPAN&gt;="&lt;A class="html-attribute-value html-resource-link" href="https://stats.wiv-isp.be/SASStoredProcess/guest?_sessionid=3C3AC7BA-A50D-4BB7-8443-9DDB59150B04&amp;amp;_program=replay&amp;amp;_entry=APSWORK.TCAT0021.SGPlot.png" target="_blank" rel="noreferrer noopener"&gt;/SASStoredProcess/guest?_sessionid=3C3AC7BA-A50D-4BB7-8443-9DDB59150B04&amp;amp;_program=replay&amp;amp;_entry=APSWORK.TCAT0021.SGPlot.png&lt;/A&gt;" &lt;SPAN class="html-attribute-name"&gt;style&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt; height: 480px; width: 640px;&lt;/SPAN&gt;" &lt;SPAN class="html-attribute-name"&gt;border&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;0&lt;/SPAN&gt;" &lt;SPAN class="html-attribute-name"&gt;class&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;c&lt;/SPAN&gt;"&amp;gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;/SASStoredProcess/guest?_sessionid=&lt;STRONG&gt;8E7E4609-4B45-4A95-8614-E6B4764FEC2E&lt;/STRONG&gt;&amp;amp;_program=replay&amp;amp;_entry=APSWORK.&lt;STRONG&gt;TCAT0005&lt;/STRONG&gt;.SGPlot.png&lt;/LI&gt;
&lt;LI&gt;/SASStoredProcess/guest?_sessionid=&lt;STRONG&gt;E21CFA30-10DC-4335-9540-601574329008&lt;/STRONG&gt;&amp;amp;_program=replay&amp;amp;_entry=APSWORK.&lt;STRONG&gt;TCAT001A&lt;/STRONG&gt;.SGPlot.png&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you think would allow me to do that easily ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm thinking adding a flag paramter to the STP&lt;/P&gt;
&lt;P&gt;and then add a rule at the end of the STP that replaces the output&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't see anything else than an _webout&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with just the img tag maybe ?&lt;/P&gt;
&lt;P&gt;, or just the png and&amp;nbsp;changing the Content-type header ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The idea would then to use it in an iframe&lt;/P&gt;
&lt;P&gt;&amp;nbsp;or retrieve the src url and inject in a proper img tag with ajax maybe (but then I would probably face&amp;nbsp;Cross-Origin Read Blocking (CORB) errors)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can I retrieve the _sessionid and the _entry that change every time the STP is called?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 09:41:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Make-stored-process-output-only-png-image/m-p/512129#M5806</guid>
      <dc:creator>mathias</dc:creator>
      <dc:date>2018-11-12T09:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Make stored process output only png image</title>
      <link>https://communities.sas.com/t5/Developers/Make-stored-process-output-only-png-image/m-p/512133#M5807</link>
      <description>&lt;P&gt;I think the &lt;STRONG&gt;_entry&lt;/STRONG&gt; from the url&lt;/P&gt;
&lt;P&gt;can be retrieved from&amp;nbsp;&lt;STRONG&gt;_tmpcat&lt;/STRONG&gt; in the stp&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the &lt;STRONG&gt;_sessionid&lt;/STRONG&gt; can be&amp;nbsp;found in&amp;nbsp;&lt;STRONG&gt;_REPLAY&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 10:01:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Make-stored-process-output-only-png-image/m-p/512133#M5807</guid>
      <dc:creator>mathias</dc:creator>
      <dc:date>2018-11-12T10:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: Make stored process output only png image</title>
      <link>https://communities.sas.com/t5/Developers/Make-stored-process-output-only-png-image/m-p/512674#M5808</link>
      <description>&lt;P&gt;I'll have a think about this. In the meantime -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Be mindful that using session IDs in your STP code like that, even temporarily, will completely&amp;nbsp;circumvent load balancing at the spawner, meaning that all of your users will be redirected to the same multibridge session &amp;amp; that part of your application will have a concurrent capacity of 1 user. See&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13635"&gt;@Vince_SAS&lt;/a&gt;'s&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Stored-Processes/Stored-processes-and-sessions-stpsrv-session-function/m-p/376516/highlight/true#M3948" target="_self"&gt;reply here&lt;/A&gt;&amp;nbsp;for details. This also risks destabilising the spawner and the JVM if you're using a guest account and are intending to have this as public-facing or high-throughput app with users queuing for the session.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sure there's a better way...&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 18:40:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Make-stored-process-output-only-png-image/m-p/512674#M5808</guid>
      <dc:creator>boemskats</dc:creator>
      <dc:date>2018-11-13T18:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: Make stored process output only png image</title>
      <link>https://communities.sas.com/t5/Developers/Make-stored-process-output-only-png-image/m-p/512939#M5809</link>
      <description>&lt;P&gt;I got a simple version working. like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let plotPath = &amp;amp;_tmpcat ; 
ods html 
	path=&amp;amp;plotPath
	style=xxx
	image_dpi=400
	device=png;

* proc sgplot ;

data _null_;
	file _webout;
	put '&amp;lt;img style="width:100%" src="https://xxx.xxx.be' &amp;amp;_REPLAY 'SGPlot2.png" &amp;gt;';
	run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I could not make the STP output a binary png file yet, so I had to output html img tag.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you are right I'm afraid &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;If I make several iframes pointing to this STP, they&amp;nbsp;load one at a time (sometimes worse, a&amp;nbsp;few will encounter errors).&lt;/P&gt;
&lt;P&gt;So it's definitely not usable on a public-facing website.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(I don't know anything about load balancing, I think we always have 1 process at a time on our sas jboss server.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 13:41:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Make-stored-process-output-only-png-image/m-p/512939#M5809</guid>
      <dc:creator>mathias</dc:creator>
      <dc:date>2018-11-14T13:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Make stored process output only png image</title>
      <link>https://communities.sas.com/t5/Developers/Make-stored-process-output-only-png-image/m-p/525513#M5810</link>
      <description>&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Is the goal to return an image file to the client, without any HTML?&amp;nbsp; If so then create a streaming stored process and use this exact code (no STPBEGIN/END) with SAS/GRAPH procedures:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;goptions devide=png gsfname=_webout;

proc gchart data=sashelp.class; vbar age / discrete; run; quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Use this &lt;SPAN&gt;exact code (no STPBEGIN/END)&amp;nbsp;&lt;/SPAN&gt;with SG procedures:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics on / imagefmt=png;

filename temp temp;

ods _all_ close;

ods html file=temp gpath=_webout;

proc sgplot data=sashelp.class; hbar age; run; quit;

ods html close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Vince DelGobbo&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;SAS R&amp;amp;D&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 18:29:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Make-stored-process-output-only-png-image/m-p/525513#M5810</guid>
      <dc:creator>Vince_SAS</dc:creator>
      <dc:date>2019-01-08T18:29:35Z</dc:date>
    </item>
  </channel>
</rss>

