php - Dompdf max-height max-width supported or not? -
I am trying to restrict images as a fixed height and width to max. So naturally, I am using maximum-height and maximum-width so that the images can remain in their maximum proportion, when the images can remain in their proportion. Works in HTML, this is my code snippet
'& lt; Table class = "separate" id = "images-table" & gt; '& Lt; Tbody & gt; ' '& Lt; TR & gt; '& Lt; TD & gt; & Nbsp; & Lt; / TD & gt; '& Lt; Td class = "uscs-logo" & gt; & Lt; Img src = "http: //localhost/dompdfTest/dompdf/uscompliancesystems_logo.png" /> & Lt; / Td> '& Lt; Td square = "sign-logo" & gt; & Lt; Img src = "http: //localhost/dompdfTest/dompdf/USCSDefaultSignature.jpg" /> & Lt; / Td> '& Lt; TD & gt; & Nbsp; & Lt; / TD & gt; '& Lt; / TR & gt; '& Lt; / Tbody & gt; '& Lt; / Table & gt; and CSS:
table # image-table. Ocecs-logo {height: 100px; Align text: left; } Table # Images-table .uscs-logo img {Max-height: 200px; Max-width: 200px; } Table # Image Table .signature {Height: 125px; Text align: right; Width: 300px; Height: auto; Maximum height: 200px; Max-width: 200px; } But what's found in PDF is a two page PDF with no image on the page because they are coming in full size. If I present it in html on the page, it gets cured.
So my question is, is the max-width and maximum-height actually supported on IMG tags?
Resizing the images on the fly with the GD PHP extension is not difficult. As far as time is cost, the browser has to scale, if you do not.
$ filename = '/ home / user / public_html / images / image.jpg'; $ Image = @imagecreatefromjpeg (); $ Original person = images ($ image); $ Originalhigh = images ($ image); $ Scale = minimum (desired desired $ / $ original person, desired $ hect / $ original haite); $ NewWidth = Ceiling ($ scale * $ original by); $ NewHeight = CIL ($ Scale * $ Original Hight); $ NewPic = imagecreatetruecolor ($ newWidth, $ newHyight); Imagecopyresampled ($ newPic, $ image, 0, 0, 0, 0, $ newWidth, $ newHeight, original original $ $, original $ $); If (imagejpeg ($ newPic, $ tmpfile)) {rename ($ tmpfile, $ filename);} and restore the memory cleanup.
imagedestroy ($ image); Imagedestroy ($ newPic);
Comments
Post a Comment