0

I need to understand how to positition/float an image created by php. I know how to position/float JPG in PHP, but am unclear of how to position/float an image generated by PHP. This script displays a barcode in the upper left-hand corner of the page. I think the header script needs some HTML/CSS to center it on the page, but don't know what that script would look like or even if I'm on the right track.

How would you change this script to display the header in the middle of the page?

<?php
require('class/BCGFont.php');
require('class/BCGColor.php');
require('class/BCGDrawing.php');
require('class/BCGpostnet.barcode.php');

$font = new BCGFont('./class/font/Arial.ttf', 18);
$color_black = new BCGColor(0, 0, 0);
$color_white = new BCGColor(255, 255, 255);

$code = new BCGpostnet();
$code->setScale(2);
$code->setThickness(30);
$code->setForegroundColor($color_black);
$code->setBackgroundColor($color_white);
$code->setFont($font);
$code->parse('98000');

// Drawing Part
$drawing = new BCGDrawing('', $color_white);
$drawing->setBarcode($code);
$drawing->draw();

header('Content-Type: image/png');

$drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
?>
2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by diafol
0

Say your image-creating file (contains the code above) is called 'imager.php' I assume you do this in files that need the image:

<img src = "imager.php" height="..." weight= "..." class="imager" />

then for the css file referenced in the head section:

.imager{
  /*whatever CSS you want to apply to the image*/
}

Was that what you wanted, or was it the CSS? If CSS, try that forum.

0

Got it! I was making it too hard.

Thanks ardav,

Niche

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.