Page 1 of 1

showing an image directly

Posted: 2006-03-23T14:27:52-07:00
by mediman
in gd it is posible to show an image directly

i.e.

Code: Select all

ImagePNG($ressource);
and no image will be saved on disk ...

now my question: is there a similar function for IM?

as far as i know display works only with x-server ...

thx in advance

mediman

Posted: 2006-03-23T15:12:49-07:00
by magick
You can display an image directly with the DisplayImage() method (depends on the language interface) but it does require an X11 server.

Posted: 2006-03-23T18:01:51-07:00
by anthony
Under PHP, you will need to either have a command output to stdout at the right place (tricky), or convert the image into a 'blob' and print that at the right point.

Posted: 2006-03-24T10:45:18-07:00
by mediman
anthony wrote: Under PHP, you will need to either have a command output to stdout at the right place (tricky), or convert the image into a 'blob' and print that at the right point.


is there for one of the both methodes a demo avaiable (php 4.4.2) ???
or is creating a temp file and unlink it inmediately the better way?

i need this for a captcha code ...

many thanks

mediman

Posted: 2006-03-24T13:59:44-07:00
by ridera
I wasn't able to get the temp file approach to work.

Appearently, the code unlinked the file before it was finished being sent to the client.

I even tried using sleep(); but, didn't work.

Posted: 2006-03-24T14:39:05-07:00
by mediman
maybe this

Code: Select all

Header ...
php://stdout 
will be the best method for temporarly images like captchas ...

Here a little Codesnippet, but didn´t work :(

Code: Select all

<?
header ("Content-type: image/png");
$blah = "convert -background none -fill gold -font /usr/local/gdfonts/candice.ttf -pointsize 56  label: Testtext";
$blah .= " \( +clone  -fx A +matte -blur 0x8  -shade 110x45  -normalize -fx '3.5u^3 - 5.05u^2 + 2.05u + 0.3' +clone  -compose Overlay -composite \)"; 
$blah .= " -matte  -compose In  -composite php://stdout";
exec($blah);
?> 
Anyone please?