[R] Using jpeg() function over cgi

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Jun 16 17:45:12 CEST 2003


"michael watson (IAH-C)" <michael.watson at bbsrc.ac.uk> writes:

> Well i run httpd as a user called "base" and if i log in to a shell
> as base, trust me the X11 display IS available then. Sooooo, if
> someone could explain WHY jpeg() won't work over cgi, then i can
> explain to my sys/admin and he can fix it for me.

It's not so much a matter of user credentials, but of mode of
operation. If you login from a dumb terminal (or a Windows machine),
then you'd have the same symptom of not being able to access the X
server (after all, someone else might be using it). If you login from
a remote Linux machine, then you won't see the problem, but the X
server you're talking to is the one on your local machine, not on the
remote machine. 

What you can do is to set up an X server separate from the one that
controls the physical display but working with a virtual frame buffer
device (Xvfb) instead, then make sure that that is accessible to your
cgi process. I'm not quite sure whether more is required than running
it as user "base" (the display server generally runs as root and is
very picky about the protocol for letting other users in).
 
> OR alternatively, if someone can explain to me how to coax bitmap()
> into producing images of the quality of jpeg()...??

It has been done, I'm pretty sure. Check the archives of the mailing
list. One option is to generate bitmaps at a higher resolution and then
smooth and scale them afterwards using e.g. pnmsmooth and pnmscale or
the ImageMagick tools.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list