Scratch everything I've said the following seems to work. Still don't
know why it didn't work it the first place.
Jeff.
app_controller.erl:
hook(A) ->
.....
{phased, {ewc, A},
fun(_Ewc, Data, _PhasedVars) ->
{ewc, html_container, index, [A, {data, Data}]}
end};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% module_controller.erl:
-module(module_controller).
-export([
image/2,
]).
-define(IMAGECMD, "cat /path/to/image.gif").
image(A, _Key) ->
Self = self(),
spawn(fun() ->
%% Read random junk
P = open_port({spawn, ?IMAGECMD},
[binary,stream, eof]),
rec_loop(Self, P)
end),
{response, {streamcontent, "image/gif", <<>>}}.
rec_loop(YawsPid, P) ->
receive
{P, {data, BinData}} ->
%% yaws_api:stream_chunk_deliver(YawsPid, BinData),
yaws_api:stream_chunk_deliver_blocking(YawsPid, BinData),
rec_loop(YawsPid, P);
{P, eof} ->
port_close(P),
yaws_api:stream_chunk_end(YawsPid),
exit(normal)
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% module_view.erl:
-module(module_view).
-export([
image/1,
]).
image(Data) -> Data.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
End of Example.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---