Development

Changeset 16282

You must first sign up to be able to contribute.

Changeset 16282

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

Rounding to prevent errors when floating point numbers are passed

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/pkImageConverterPlugin/trunk/lib/pkImageConverter.class.php

    r15754 r16282  
    9999  static public function scaleToNarrowerAxis($fileIn, $fileOut, $width, $height, $quality = 75) 
    100100  { 
     101    $width = ceil($width); 
     102    $height = ceil($height); 
     103    $quality = ceil($quality); 
    101104    list($iwidth, $iheight) = getimagesize($fileIn);  
    102105    if (!$iwidth) { 
     
    116119    $width, $height, $quality = 75) 
    117120  { 
     121    $width = ceil($width); 
     122    $height = ceil($height); 
     123    $quality = ceil($quality); 
    118124    if ($width === false) { 
    119125      $scaleParameters = "-ysize " . ($height + 0); 
     
    129135    $quality = 75) 
    130136  { 
     137    $quality = ceil($quality); 
    131138    $scaleParameters = $factor + 0;   
    132139    return self::scaleBody($fileIn, $fileOut, $scaleParameters, $quality); 
     
    136143    $quality = 75) 
    137144  { 
     145    $width = ceil($width); 
     146    $height = ceil($height); 
     147    $quality = ceil($quality); 
    138148    list($iwidth, $iheight) = getimagesize($fileIn);  
    139149    if (!$iwidth)  
     
    209219  static public function convertFormat($fileIn, $fileOut, $quality = 75) 
    210220  { 
     221    $quality = ceil($quality); 
    211222    return self::scaleBody($fileIn, $fileOut, false, $quality); 
    212223  }