You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a part of source code of Html::writeImageInCell.
Class MemoryDrawing has offsets attributtes also, and I dont understand why not sets 'top','left' for the 'img' Tag.
if ($drawinginstanceof Drawing) {
$filename = $drawing->getPath();
// Strip off eventual '.'$filename = (string) preg_replace('/^[.]/', '', $filename);
// Prepend images root$filename = $this->getImagesRoot() . $filename;
// Strip off eventual '.' if followed by non-/$filename = (string) preg_replace('@^[.]([^/])@', '$1', $filename);
// Convert UTF8 data to PCDATA$filename = htmlspecialchars($filename, Settings::htmlEntityFlags());
$html .= PHP_EOL;
$imageData = self::winFileToUrl($filename, $this->isMPdf);
if ($this->embedImages || substr($imageData, 0, 6) === 'zip://') {
$picture = @file_get_contents($filename);
if ($picture !== false) {
$imageDetails = getimagesize($filename) ?: [];
// base64 encode the binary data$base64 = base64_encode($picture);
$imageData = 'data:' . $imageDetails['mime'] . ';base64,' . $base64;
}
}
$html .= '<img style="position: absolute; z-index: 1; left: ' .
/**** give Offset ****/$drawing->getOffsetX() . 'px; top: ' . $drawing->getOffsetY() . 'px; width: ' .
$drawing->getWidth() . 'px; height: ' . $drawing->getHeight() . 'px;" src="' .
$imageData . '" alt="' . $filedesc . '" />';
} elseif ($drawinginstanceof MemoryDrawing) {
$imageResource = $drawing->getImageResource();
if ($imageResource) {
ob_start(); // Let's start output buffering.imagepng($imageResource); // This will normally output the image, but because of ob_start(), it won't.$contents = (string) ob_get_contents(); // Instead, output above is saved to $contentsob_end_clean(); // End the output buffer.$dataUri = 'data:image/png;base64,' . base64_encode($contents);
// Because of the nature of tables, width is more important than height.// max-width: 100% ensures that image doesnt overflow containing cell// width: X sets width of supplied image.// As a result, images bigger than cell will be contained and images smaller will not get stretched$html .= '<img alt="' . $filedesc . '" src="' . $dataUri . '" style="max-width:100%;width:' . $drawing->getWidth() . 'px;" />';
}
}
The text was updated successfully, but these errors were encountered:
This is a part of source code of Html::writeImageInCell.
Class MemoryDrawing has offsets attributtes also, and I dont understand why not sets 'top','left' for the 'img' Tag.
The text was updated successfully, but these errors were encountered: