Development

Changeset 16281

You must first sign up to be able to contribute.

Changeset 16281

Show
Ignore:
Timestamp:
03/12/09 21:01:07 (4 years ago)
Author:
boutell
Message:

Variable height previews

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/pkPersistentFileUploadPlugin/trunk/lib/widget/pkWidgetFormInputFilePersistent.class.php

    r16153 r16281  
    7575        pkValidatorFilePersistent::removeOldFiles($dir); 
    7676        $imagePreview = $this->getOption('image-preview'); 
    77         $width = $imagePreview['width'] + 0; 
    78         $height = $imagePreview['height'] + 0; 
     77        $width = $imagePreview['width']; 
     78        $height = $imagePreview['height']; 
     79        if ($height === false) 
     80        { 
     81          list($iwidth, $iheight) = getimagesize($info['tmp_name']); 
     82          if ($iheight && $iwidth) 
     83          { 
     84            $height = $width * ($iheight / $iwidth); 
     85          } 
     86        } 
    7987        $resizeType = $imagePreview['resizeType']; 
    8088        if (!in_array($resizeType, array('c', 's'))) 
     
    104112            $info['tmp_name'],  
    105113            $output, 
    106             $imagePreview['width']
    107             $imagePreview['height']); 
     114            $width
     115            $height); 
    108116        } 
    109117        $result .= "<img src='$url' />";