$pdf->Image($src, $x, $y, 0, 0, $ext, '', '', true, 300, 'R');
What is the new x value?
See GetX() and GetAbsX() in the documentation.
Sorry. I only just read the subject line.
I would do some regular PHP to find the dimensions of your image and then do the maths based on the DPI.
See: http://php.net/manual/en/function.getimagesize.php
I am unfamiliar with the math needed.
It will be something like:
$a = $imageWidth/300; //Gives image width in inches; $x = $pageWidth - $a - $rightMargin;
This will work if your default unit is inches, otehrwise you'd need to convert units.
This is what I came up with:
$x = $pdf->GetX(); $y = $pdf->GetY(); if ($float == 'right') { $pdf->Image($src, $x, $y, 0, 0, $ext, '', '', true, 72, 'R'); $page = $pdf->getPage(); $y = $pdf->GetY(); $xb = $pdf->getImageRBX(); $yb = $pdf->getImageRBY(); $filename = '/home/storytelling/public_html' . $src; list($width, $height, $type, $attr) = getimagesize($filename); $wid = ($width / $pdf->getImageScale()) / $pdf->getScaleFactor(); $x = $xb - $wid - 1; // add a space to the left $regions = array(); $region = array(); $region['page'] = $page; $region['xt'] = $x; $region['yt'] = $y; $region['xb'] = $x; $region['yb'] = $yb; $region['side'] = 'R'; array_push($regions, $region); // set page regions, check also getPageRegions(), addPageRegion() and removePageRegion() $pdf->setPageRegions($regions); }
Log in to post a comment.
$pdf->Image($src, $x, $y, 0, 0, $ext, '', '', true, 300, 'R');
What is the new x value?
See GetX() and GetAbsX() in the documentation.
Sorry. I only just read the subject line.
I would do some regular PHP to find the dimensions of your image and then do the maths based on the DPI.
See: http://php.net/manual/en/function.getimagesize.php
I am unfamiliar with the math needed.
It will be something like:
$a = $imageWidth/300; //Gives image width in inches;
$x = $pageWidth - $a - $rightMargin;
This will work if your default unit is inches, otehrwise you'd need to convert units.
This is what I came up with: