Poster Engine — Convoca Enroll
Architecture: HTML → PDF → Image¶
En lugar de componer las imágenes píxel a píxel con Imagick, el motor v3 sigue un proceso de calidad editorial:
Why This Approach¶
- CSS3 native: Flexbox, Grid, gradients, shadows, border-radius — no manual coordinate calculations
- Google Fonts: Load any font via
@import url(...)without TTF files on the server - Maintainable: Edit posters by modifying HTML/CSS files, not PHP array logic
- Clean rasterization: Imagick only handles mechanical PDF→PNG conversion (DPI, resize, export)
Pipeline Details¶
- Pass 1 — HTML Compilation (
compile_html()) - Reads PHP template from
templates/html/{slug}.php - Injects activity data as extracted variables
-
Returns full HTML document with
<style>block -
Pass 2 — PDF Rendering (
html_to_pdf()) - Uses
mpdf/mpdfv8 with format set to exact pixel dimensions - No margins, no page breaks
-
Temporary PDF stored in uploads
convoca-temp/ -
Pass 3 — Rasterization (
pdf_to_image()) - Opens PDF page 1 with Imagick at ~360 DPI
- Resizes to exact format dimensions (Lanczos filter)
- Strips metadata, sets quality (92% for JPEG/WebP)
- Deletes temporary PDF
Template Variables¶
All PHP templates in templates/html/ receive: