Prechádzať zdrojové kódy

Fix image dimensions in PDF

Alan Lam 8 rokov pred
rodič
commit
fe193110e2

+ 15 - 2
template_processing/mystery_shop/test_pdf.php

@@ -132,9 +132,22 @@ $pdf->SetFont("Arial", "B", $normal_font_size);
 $pdf->Cell(95, $cell_height, "Location Photo", 0, 1);
 $pdf->SetFont("Arial");
 
-$location_photo = $test->getDirectory() . "/location_photo.jpg";
+$location_photo_path = $test->getDirectory() . "/location_photo.jpg";
 
-$pdf->Image($location_photo, $pdf->GetX(), $pdf->GetY(), 90);
+$size = getimagesize($location_photo_path);
+list($image_width, $image_height) = $size;
+
+$width = 0;
+$height = 0;
+if($image_height > $image_width) {
+	$height = 70;
+}
+else {
+	$width = 70;
+}
+
+
+$pdf->Image($location_photo_path, $pdf->GetX(), $pdf->GetY(), $width, $height);
 
 
 // Staff Details