Changeset 20335


Ignore:
Timestamp:
Jan 22, 2013, 8:16:36 PM (11 years ago)
Author:
rvelices
Message:

some code comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/derivative_params.inc.php

    r19703 r20335  
    7171  }
    7272
     73  /** crops horizontally this rectangle by increasing left side and/or reducing the right side.
     74  @param pixels the amount to substract from the width
     75  @param coi a 4 character string (or null) containing the center of interest*/
    7376  function crop_h($pixels, $coi)
    7477  {
     
    99102  }
    100103
     104  /** crops vertically this rectangle by increasing top side and/or reducing the bottom side.
     105  @param pixels the amount to substract from the height
     106  @param coi a 4 character string (or null) containing the center of interest*/
    101107  function crop_v($pixels, $coi)
    102108  {
     
    130136
    131137
    132 /*how we crop and/or resize an image*/
     138/** Paramaters for derivative scaling and cropping. Instance of this class contained by DerivativeParams class.*/
    133139final class SizingParams
    134140{
     141  /**
     142  @param ideal_size two element array of maximum output dimensions (width, height)
     143  @param max_crop range 0=no cropping ... 1= max cropping (100% of width/height); expressed as a factor of the input width/height
     144  @param min_size used only if max_crop != 0 - two element array of output dimensions (width, height)
     145  */
    135146  function __construct($ideal_size, $max_crop = 0, $min_size = null)
    136147  {
    137148    $this->ideal_size = $ideal_size;
    138     $this->max_crop = $max_crop;
     149    $this->max_crop = $max_crop; // range 0=no cropping ... 1= max cropping (100% of width/height)
    139150    $this->min_size = $min_size;
    140151  }
     
    168179  }
    169180
     181  /* calculate the cropping rectangle and the scaled size for an input image size
     182  @param in_size two element array of input dimensions (width, height)
     183  @param coi empty or a four character encoded string containing the center of interest (unused if max_crop=0)
     184  @param crop_rect output ImageRect containing the cropping rectangle or null if cropping is not required
     185  @param scale_size output two element array containing width and height of the scaled image
     186  */
    170187  function compute($in_size, $coi, &$crop_rect, &$scale_size)
    171188  {
     
    233250
    234251
    235 /*how we generate a derivative image*/
     252/** All needed parameters to generate a derivative image.*/
    236253final class DerivativeParams
    237254{
    238   public $type = IMG_CUSTOM;
     255  public $type = IMG_CUSTOM; // string IMG_xxx
    239256  public $last_mod_time = 0; // used for non-custom images to regenerate the cached files
    240257  public $use_watermark = false;
    241   public $sizing;
    242   public $sharpen = 0;
     258  public $sizing; // of type SizingParams
     259  public $sharpen = 0; // range 0= no sharpening ... 1= max sharpening
    243260
    244261  function __construct($sizing)
     
    282299    return true;
    283300  }
    284  
     301
    285302  function will_watermark($out_size)
    286303  {
Note: See TracChangeset for help on using the changeset viewer.