MantisBT - TestLink
View Issue Details
0008576TestLinkReportspublic2019-02-21 15:012019-02-22 15:06
PepaS 
 
lowfeature requestalways
newopen 
1.9.19 (2019 Q1) 
 
MySQL
php 7.3.1
0008576: test report - attachment image dimension
if the attachment image is too large, it breaks the report structure both for HTML and pseudoMSword

would be great to add a function to reduce dimension of the image to match the paper size
added hotfix for me (starting line 1264), but there might be better solution - I am not experienced with php

if($fitem['is_image']) {
  $code .= "
  • {$safeFileName}
  • ";

      $pathname = $st->repoDir . $fitem['file_path'];
      list($iWidth, $iHeight, $iT, $iA) = getimagesize($pathname);
      $imgRatio = $iWidth/$iHeight;
      if($iWidth > 900 or $iHeight > 700) {
        if($iWidth > $iHeight) {
          $imgDiff = round($iWidth / 600);
        } else {
          $imgDiff = round($iHeight / 450);
        }
        $iWidth = $iWidth/$imgDiff;
        $iHeight = $iHeight/$imgDiff;
      }
      $iDim = ' width=' . $iWidth . ' height=' . $iHeight;
      $code .= '
  • <img ' . $iDim .
               ' src="' . $env->base_href . $cmout . '">';
    } else {
  • No tags attached.
    Issue History
    2019-02-21 15:01PepaSNew Issue
    2019-02-21 17:26fmanNote Added: 0028543
    2019-02-22 06:32PepaSNote Added: 0028550
    2019-02-22 15:06fmanNote Added: 0028552

    Notes
    (0028543)
    fman   
    2019-02-21 17:26   
    well, may be is better that people resize the image.
    (0028550)
    PepaS   
    2019-02-22 06:32   
    in that case It may be useful to put a warning about dimension into $TLS_max_size_file_upload

    ...as long as we are humans, I will stick to the function anyway
    (0028552)
    fman   
    2019-02-22 15:06   
    $TLS_max_size_file_upload blocks the upload but may be what is ok for a txt file is not good for an image

    Being human and being lazy or fuzzy are two different things