$q = safe_r_sql($MySQL); $pdf->addpage(); $NumCols = floor(($PaperWidth - 2 * $MarLeftRight) / max(1, $StickCols)); $HGap = ($PaperWidth - 2 * $MarLeftRight - $NumCols * $StickCols) / ($NumCols - 1); $NumRows = floor(($PaperHeight - $MarTop - $MarTop) / max(1, $StickRows + 3)); $VGap = ($PaperHeight - $MarTop - $MarTop - $NumRows * ($StickRows + 3)) / ($NumRows - 1); $X = $MarLeftRight; $Y = $MarTop; $pdf->SetFontSize(7); error_reporting(E_ALL); while ($r = safe_fetch($q)) { if (!is_file($file = $CFG->DOCUMENT_PATH . 'TV/Photos/' . $_SESSION['TourCodeSafe'] . '-En-' . $r->PhEnId . '.jpg')) { continue; } $pdf->Image($file, $X, $Y, $StickCols, $StickRows, 'JPG', '', '', true, 300, '', false, false, 1, true); $pdf->setXY($X, $Y + $StickRows); $pdf->cell($StickCols, 3, $r->code, '', '', 'C', '', '', 1); $X += $StickCols + $HGap; if ($X + $StickCols > $PaperWidth) { $X = $MarLeftRight; $Y += $StickRows + $VGap + 3; if ($Y + $StickRows > $PaperHeight) { $Y = $MarTop; $pdf->addpage(); } } } } else { $lblW = $pdf->GetPageWidth() / 3; $lblH = $pdf->GetPageHeight() / 8; $lblSp = $lblH * 0.05;