pdf_helper.php 390 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace Helpers;
  3. class PdfHelper {
  4. public static function getImageConfig(string $path): array {
  5. [$image_width, $image_height] = getimagesize($path);
  6. $width = null;
  7. $height = null;
  8. if($image_height > $image_width) {
  9. $height = "8cm";
  10. }
  11. else {
  12. $width = "100%";
  13. }
  14. $contents = file_get_contents($path);
  15. return compact("width", "height", "contents");
  16. }
  17. }