printing an image done with the GD library

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

printing an image done with the GD library

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

can you explain more

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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()
Post Reply