Issue
I have an image I am trying to force to standard 8.5 x 11 for printing. Because of how it is rendered, I could figure out a way to get img src="" to work and all of the php functions I found blew out the memory when getting even close.
<?php
$image = imagecreatefrompng('/var/www/localhost/htdocs/contactdb/2.png');
header('Content-type: image/png');
$black = imagecolorallocate($image, 0, 0, 0);
$font_path = '/var/www/localhost/htdocs/contactdb/arial.ttf';
$text = "This is a message!";
imagettftext($image, 100, 0, 275, 800, $black, $font_path, $text);
imagepng($image);
imagedestroy($image);
?>
Solution
If you want to resize your image on printing you can create a print.css. Include it in your html page with:
<link rel="stylesheet" href="print.css" screen="print">
..and then add your style property for the image that you want to be resized in print.css
img.yourimage
{
width: newwidth;
height: newheight;
}
Answered By - Emre Aydin Answer Checked By - David Goodson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.