Page 1 of 1

printing an image done with the GD library

Posted: Thu Apr 21, 2005 5:39 am
by pelegk2
i am making labels, and i want to print them on the labels printer!
the label code is like this :

Code: Select all

<?
header('Content-Type: text/html; charset=iso-8859-8');

$im = imagecreate(86,281);
$bg = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
font = imageloadfont("C:\\Program Files\\Apache Group\\Apache2\\htdocs\\test\\Miriam Fixed.gdf");
imagestringup($im, $font,11,80, strrev("áå÷ø"), $black);
imagepng($im);
?>
the thing is when on the clisend side i do :

Code: Select all

&lt;img src=&quote;http://localhost/test/jpgraph-1.17/jpgraph-1.17/src/Examples/test0.php&quote;&gt;&lt;/img&gt;
&lt;script&gt;
window.print();
&lt;/script&gt;
the thing is when i choosed the label printer and print it i accept a cleant label !!!
maybe is beacuse the image isnt execlly an image in the brwoser (well i don know execlly how to explain altgouh i see it on screen!)

does any1 have an idea?
thnaks i nadvance
peleg

the image isn't printed to the

Posted: Thu Apr 28, 2005 5:46 pm
by feyd
the image is an image in the browser, you may be getting a problem from your browser doing things to it. Potentially, you need to send a content-length header to get IE to display and read the image "correctly."

</img> isn't needed.

can you explain more

Posted: Thu Apr 28, 2005 6:51 pm
by pelegk2
what do u mean by :
you need to send a content-length header to get IE to display and read the image "correctly."
???
thnaks i nadvance
peleg

Posted: Thu Apr 28, 2005 6:57 pm
by feyd
IE will read the image correctly (if a known format), but will convert it to bitmap format implicitly if the content-length header is missing from the http response.

header()